Giorgio Napolitano, an 87-year-old political veteran who had been planning to embark on a well-earned retirement within weeks, has become the first Italian president to be re-elected to serve a second term, after squabbling and discredited party leaders who had failed to agree on his successor begged him to stay on "in the higher interests of the country".

In an unprecedented move which observers said raised Italy's chances of seeing the formation a broad coalition government, the widely-respected former Communist was re-elected with cross-party backing that included Silvio Berlusconi's centre-right Freedom People (PDL) party and the centre-left Democratic party (PD).

Napolitano received 738 votes, easily surpassing the simple majority needed in the sixth round of an election that since Thursday had been dogged by vicious infighting in the PD and had compounded the political stalemate in which Italy has been stuck for weeks.

The result was greeted with relief and a standing ovation by most MPs in the chamber of deputies. But outside hundreds of protesters damned what they saw as a depressing sign of Italy's political stagnation and back-room deal-making.

In a furious denunciation on his blog, Beppe Grillo, the former comedian and founder of the anti-establishment Five Star Movement (M5S), declared Napolitano's re-election a "coup d'état" that had been engineered by political heavyweights desperate to "prevent change". Announcing he was on his way to Rome in his camper van to protest the move outside the parliament, he called for millions to join him in a "mobilisation of the people".

The M5S had backed the respected academic Stefano Rodotá for head of state. He received 217 votes. No other candidate attracted any significant support. Romano Prodi, the former prime minister whose candidacy was humiliatingly rebuffed on Friday, received two votes.

Napolitano's decision to stand again for the presidency came after political leaders including Berlusconi and Mario Monti, Itay's caretaker technocratic prime minister, visited him one by one at the Quirinale palace on Saturday morning to plead with him to stay on.

Until then, Napolitano, who will be 88 in June and would be nearly 95 by the end of a second seven-year term, had dismissed such appeals, citing his advancing years.

But such is the respect he commands in an otherwise deeply polarised and fractured political landscape that in the end it was to Re Giorgio (King George) that the party leaders, desperate to bring closure to an electoral saga that had covered none of them in glory, turned.

"I believe I must offer my availability as requested," he said in a brief statement just before MPs were due to begin voting in the sixth ballot, adding that he could not "shun my responsibility towards the nation". Pointedly, he added that he trusted that his decision would be met with "a similar collective assumption of responsibility" by the political leaders.

The presidency is largely a ceremonial role but is crucial in periods of instability as only the head of state has the power to dissolve parliament, call elections and name a new prime minister.

In the eight weeks since February's inconclusive parliamentary elections, Napolitano has made no secret of his desire to see a government of some kind formed rather than sending Italians back to the polls. Pier Luigi Bersani, the centre-left PD leader to whom he had given an exploratory mandate to form a government, had refused to enter into a grand coalition arrangement with Berlusconi's centre-right bloc, and the M5S had refused to enter into anything with him.

On Friday night, though, a beleaguered Bersani said he would step down as PD leader as soon as a new president was chosen, thus potentially opening the path to fresh negotiations which Napolitano is expected to begin immediately. Some observers speculated that Giuliano Amato, a two-time prime minister who is himself now 74, could serve as prime minister in a new government with a limited lifetime and reformist remit.