Conservative leader loses no-confidence vote paving the way for Socialist Pedro Sanchez to take reins.

Spain’s parliament has deposed Prime Minister Mariano Rajoy in a no-confidence vote sparked by fury over his party’s corruption woes, paving the way for a takeover by opposition leader Pedro Sanchez.

An absolute majority of 180 legislators voted for the motion on Friday, making Rajoy the first prime minister to be removed in a no-confidence vote since Spain transitioned to democracy in 1977.

Speaking before the vote, Rajoy appeared to have accepted his fate and congratulated Sanchez on his new position.

“It has been an honour to be the prime minister of Spain,” he said.

{articleGUID}

“It has been an honour to leave behind a better Spain than the one that I found when I took over government.

“I wish my substitute will be able to say the same.”

The vote was triggered by a scandal involving Rajoy’s centre-right People’s Party (PP), which saw former PP members handed jail sentences this month for their part in the long-running Operacion Guertel corruption case.

The sting looked at Spanish businessmen who were bribing PP politicians in exchange for lucrative public contracts, with the party receiving a $300,000 fine as a result.

Luis Barcenas, a senator and PP treasurer, had testified that the party kept a slush fund with donations from businessmen, and that some party officials received non-taxable bonuses in addition to their salaries.

Spanish media has placed the scandal under serious scrutiny, giving coverage to the raid in PP’s national headquarters and the destruction of hard drives. It then released a series of private messages between Rajoy and Barcenas.

Rajoy and other PP witnesses testified in court that the hidden accounts were unknown to them.

‘Mature democracy’

Al Jazeera’s Neave Barker, reporting from Madrid, said Rajoy’s demise was unprecedented in recent Spanish history.

“History has been made … it’s the first time a Spanish politician has unseated a sitting prime minister in a vote of no-confidence,” our correspondent said.

“What happens next, we’re entering into uncharted territory.”

Spain’s Socialist leader Pedro Sanchez faces a difficult task forming an alliance to govern [Sergio Perez/Al Jazeera]

Matt Qvortrup, a professor of political science at Coventry University, the UK, told Al Jazeera the no-confidence vote was a sign that Spain was a “mature democracy”.

“When somebody is not behaving well, then they can be removed by democratic means that is a massive step forward from when … it was a fascist dictatorship,” he said.

“Spain has been one of the most successful countries to democratise and in some ways, it’s a sign of maturity.”

Qvortrup said the corruption scandal could force a “change of guard” within Rajoy’s party and warned that Spain’s new leader would struggle to form a government due to opposition within his own party and beyond.

Sanchez’s minority government will now have to set about the task of building alliances with parties, which include an anti-austerity alliance led by Podemos and nationalist parties, notably Basque separatists.

Simon Tobeau, assistant professor at the School of Politics and International Relations at Nottingham University, said it will be difficult for the incoming administration to maintain a stable government while introducing legislation at an effective rate.

“He [Pedro Sanchez] is the leader of a party which is very weak in parliament [with] only 84 seats so he’s very short of a majority.”

“In order to prop up the government and to basically introduce legislation, he’s going to rely on the support of a half-dozen political parties including the left wing populous party Podemos as well as a number of different, regionalist political parties from Catalonia, the Basque country and Valencia.”

The socialist party also faces the challenge of allaying investor fears over political stability and dealing with Catalan separatists.