Italy's 87-year-old President Giorgio Napolitano was re-elected by lawmakers on Saturday in a desperate bid by right and left to end a two-month deadlock, a move slammed as a "coup" by a protest party that staged a rally in front of parliament.
Napolitano won with a sweeping majority, early results showed, to cheers inside the chamber but jeering from protesters outside who chanted "Shame!" and were joined by lawmakers from the anti-establishment Five Star Movement.
The election brings to an end a chaotic series of votes this week that saw the candidacies of former European Commission president Romano Prodi and former trade union leader Franco Marini rejected and the centre-left in complete disarray.
The president on Saturday agreed to stand for an unprecedented second term -- the first Italian president to do so -- after pleas from outgoing prime minister Mario Monti, rightist leader Silvio Berlusconi and leftist leader Pier Luigi Bersani.
The ex-communist is considered as being above the party political fray and is respected by rival political forces, which have been at loggerheads since a general election in February that yielded no clear winner and left the economy in limbo.
But Beppe Grillo, leader of the Five Star Movement party which won a quarter of the vote and is shaking up Italian politics, called for a "popular mobilisation" against what he portrayed as a deal between power-hungry traditional politicians.
"We have to be millions... Either we have some democracy or we die as a country," said Grillo, a former comedian turned firebrand, who is expected to join the rally in Rome later on Saturday and said he would stay "as long as needed".
Grillo's party had supported Stefano Rodota, a well-liked 79-year-old academic and human rights advocate, for president but he failed to get elected in six rounds of voting since Thursday.
Napolitano as recently as last week had ruled out the prospect of staying on, saying he had "done everything I could" to end the stalemate and saying he was looking forward to his retirement as his seven-year mandate draws to a close.
He is not expected to serve out the full term but instead only stay in office the time needed to end the deadlock and then resign at the end of a political career that began in the Second World War when he was an anti-fascist activist.
"I must assume my responsibilities before the nation," Napolitano said in a statement ahead of his election, calling on parties too to show "collective responsibility" for the country.
A former top Italian Communist Party official, Napolitano was credited with engineering former European commissioner Monti's rise to power after then premier Berlusconi's chaotic ouster in 2011 during a wave of panic on the financial markets.
Napolitano has struggled with the current crisis, however, also because before his re-election he did not have the power to call early elections as the constitution prevents presidents from doing so in the last six months of their mandate.
Italian presidents hold a mostly ceremonial role that takes on huge importance during times of instability and can help form governments.
The main centre-left coalition narrowly won elections in February but failed to get enough votes for an overall majority in parliament.
The leadership of the leftist Democratic Party (PD) -- its secretary Bersani and chairwoman Rosy Bindi -- resigned on Friday after the two presidential candidates it proposed failed.
Marini and Prodi both withdrew their candidacies.
Prodi lost after 101 lawmakers from the centre-left rebelled against their leadership and did not vote for him -- a sign of deep divisions.
"Collective Suicide", read the headline of an editorial in leftist daily Il Fatto Quotidiano, adding that the PD was "in tatters".
Bersani had been the target of growing criticism after he threw away a big lead in the opinion polls ahead of the February elections.
He said he would step down as soon as a new president was elected and his deputy Enrico Letta was expected to take over interim powers.
The eurozone's third largest economy has been in political deadlock since the elections, with politicians unable to strike a compromise on a government amid a devastating recession.