Spain has turned the page on a 10-month political crisis after politicians voted the conservatives back into power.
Aided by divisions among his rivals and the Socialist Party's decision to abstain from the vote in order to avoid going to the polls one more time, Prime Minister Mariano Rajoy won a crunch parliamentary confidence vote on Saturday that will see him officially re-appointed as Spain's leader.
After winning the confidence vote, Rajoy said he will announce his new cabinet on Thursday.
READ MORE: Spain's Socialists lift veto on minority government
In a sign of how deep the divisions run, former Socialist chief Pedro Sanchez, a staunch opponent of Rajoy who was ousted in a party rebellion this month, announced he was quitting parliament just hours before the vote in a tearful media appearance.
Before the vote, hundreds of protesters unhappy about corruption and sweeping spending cuts during Rajoy's first term took to the streets under a strong police watch in Madrid, shouting: "They don't represent us".
"There is a lot of anger here also at the way that the Socialist Party has decided to abstain from this vote and, therefore, allow Rajoy to be able to form a minority government," said Al Jazeera's Sonia Gallego, reporting from a protest rally near the parliament in Madrid.
"A lot of socialist grassroots activists feel that the soul of their party has disappeared and sort of got lost in this political fracas."
Rajoy's policy choices during his first term also caused a lot of public anger.
"There is a lot of anger at the fact that under his government there was a $35bn bailout to the banks. And all this time, while the banks were being bailed, social security services have taken hits.
"So there is a lot of anger about how Spanish society has developed under Rajoy."
| Former Socialist chief Pedro Sanchez announced Saturday he had resigned as a politician [Susane Vera/Reuters]
Socialists torn apart
Party leaders this week appeared far from conciliatory as the confidence vote neared.
They came out fighting, criticising Rajoy and each other just as they had over the past 10 months as the country went through two inconclusive elections.
OPINION: Spain - Is this the end of the Socialists?
This unstable period saw Spain go from jubilation and hope after polls last December ended the two-party system, as millions voted for two upstart parties, to disillusion following repeat polls in June that yielded similarly inconclusive results.
Rajoy's Popular Party (PP) won both elections, but without enough parliamentary seats to govern alone. As no political grouping was able to agree on a viable coalition, Spain looked set for an unprecedented third election in less than a year.
This all changed last weekend when the Socialists swallowed a bitter pill and opted to abstain in Saturday's confidence vote to avoid more polls, after weeks of bitter in-fighting that saw Sanchez ousted as leader.
This gave Rajoy enough traction to see him through the vote.
In retaliation, Sanchez announced on Saturday that he had resigned as a politician, unable to choose between going against his principles and abstaining, or going against his party and voting "no" to Rajoy.
In an announcement just hours before the vote, the 44-year-old emphasised "how painful the decision was" before breaking down and choking back tears.
Unlike when he came to power in 2011 with an absolute majority, Rajoy's party will only have 137 out of 350 seats in parliament and will face huge opposition, forcing him to negotiate every bill.
First on his list will be a 2017 budget, which may need at least five billion euros ($5.5bn) in spending cuts to reduce the deficit under EU pressure.
OPINION: Spanish leftists join fight against ISIL
But this is likely to face stiff opposition both in parliament and on the street, and already Rajoy's rivals have pledged to vote against it.
Rajoy, meanwhile, has called on the opposition to let him govern effectively, pointing to the return of economic growth and a drop in unemployment on his watch after a devastating financial crisis.
Political analyst Pablo Simon said there was "no doubt" his term in office would be the most "turbulent" ever in Spain, and could prompt Rajoy to call early elections if he keeps hitting brick walls.
But he predicted Rajoy would not find it as difficult as expected.
The Socialists, for one, will need time to rebuild in the opposition and will not want early elections, knowing they would fare badly after their public breakdown.
The PP also has a majority in the Senate, and may be able to form pacts with smaller parties in the lower house to see laws through, Simon added.
Source: Al Jazeera News And News Agencies