ROME (Reuters) - Italian Prime Minister Matteo Renzi announced on Monday that he would resign after suffering a resounding defeat in a referendum over constitutional reform, leaving the euro zone’s third-largest economy in political limbo.

Italy’s largely ceremonial head of state, President Sergio Mattarella, told the prime minister to stay on until parliament had approved the 2017 budget. That could be achieved as soon as later this week, after which, the president said, Renzi would be free to tender his resignation.

His decision to quit after less than three years in office deals a new blow to Western political establishments, still in shock from Britain’s unexpected vote to leave the European Union and the U.S. election of outsider Donald Trump as president.

The referendum, intended to change rules to make Italy more governable, was opposed by right-wing and populist parties, including groups that want Italy to ditch the euro.

Those groups have crowed that the referendum showed voters reject traditional elites, in the vein of the victories of Brexit and Trump, although mainstream opposition parties and even some leaders of Renzi’s fractured center-left Democratic Party (PD) had also campaigned for “no”.

Italy’s youngest ever premier had been feted around the world as a pro-European reformer and lauded by U.S. President Barack Obama for his “bold, progressive” leadership. Obama had hoped Renzi would stay on even if he lost the referendum.

But the 41-year-old Renzi said he would leave office after voters decisively rejected his plans to reduce the role of the upper house Senate and centralize power. Voters had turned the referendum into a de facto vote on Renzi, who gambled everything by pledging to quit if he lost.

After a meeting lasting about half an hour, Mattarella’s office said in a statement that the prime minister had told the president he could no longer remain in office.

The president, who serves as the ultimate political arbiter in times of crisis, told Renzi to see through the passage of the budget, so as to prevent emergency funding rules from kicking in at the start of the year.

Slideshow ( 17 images )

After the referendum the euro initially fell along with European stock and bond markets on concerns that early elections could follow, possibly paving the way for an anti-euro party to win power. But markets rebounded as European officials dismissed talk of a broader euro zone crisis.

It was not immediately clear if Renzi would retain enough support in his PD to remain party leader - a role that could give him a say in who becomes the next prime minister. Party leaders are due to meet on Wednesday.

Economy Minister Pier Carlo Padoan, who has pulled out of meetings with European finance ministers in Brussels this week, is viewed as a possible candidate for prime minister. Senate President Pietro Grasso and Transport Minister Graziano Delrio have also been tipped as potential premiers.

The government crisis could open the door to elections next year and to the possibility of the opposition 5-Star Movement gaining power in the heart of the single currency area. The movement, founded by a former comedian, campaigned hard for a ‘No’ vote and wants to hold a referendum to ditch the European common currency.

“I take full responsibility for the defeat,” Renzi said in his emotional, midnight speech.

“I will greet my successor with a smile and a hug, whoever it might be,” he said, struggling to contain his emotions when he thanked his wife and children for their support.

MARKETS RESILIENT

“No” won an overwhelming 59.1 percent of the vote in Sunday’s vote. About 33 million Italians, or two-thirds of eligible voters, cast ballots following months of bitter campaigning that pitted Renzi against all major opposition parties, including the anti-establishment 5-Star.

Slideshow ( 17 images )

The euro briefly tumbled overnight to 21-month lows against the dollar, as markets worried instability could deal a hammer blow to Italian banks, which are looking to raise around 20 billion euros ($21 billion) in coming months.

By early in the European morning, the currency had largely rebounded. But Italy’s banking sector - which is weighed down by more than 350 billion euros of bad loans - was down 2.2 percent at the close of trading. [.FTIT8300]

Shares in Monte dei Paschi di Siena, Italy’s third largest lender, closed down 4.2 percent after as a consortium of investment bankers met to discuss a capital increase to raise 5 billion euros which the bank needs by the end of the month to avoid being wound down.

When Renzi does resign, Mattarella will consult with party leaders before naming a new prime minister - the fourth successive head of government to be appointed without an electoral mandate, a fact that underscores the fragility of Italy’s political system.

The new prime minister, who will need the backing of Renzi’s PD to take office, will have to draw up a new electoral law, with 5-Star urging a swift deal to open the way for elections in early 2017, a year ahead of schedule.

“From tomorrow, we will start work on putting together 5-Star’s future program and the team of people that will make up a future government,” said Luigi Di Maio, tipped to be the group’s prime ministerial candidate.

Opinion polls put 5-Star neck-and-neck with the PD.

DEMOLITION MAN

Renzi took office in 2014 promising to shake up hidebound Italy and presenting himself as an anti-establishment “demolition man” determined to crash through a smothering bureaucracy and reshape creaking institutions.

However, his economic policies have made little impact, and the 5-Star Movement has claimed the anti-establishment banner, tapping into a populist mood that saw Britons vote to leave the EU and Americans elect Trump.

Italy has suffered for years from a stagnant economy, and more recently has faced a migration crisis as the arrival point for hundreds of thousands of Africans crossing the Mediterranean from Libya.

In a moment of relief for mainstream Europe, Austrian voters on Sunday rejected Norbert Hofer, vying to become the first freely elected far-right head of state in Europe since World War Two, choosing a Greens leader as president instead.

But elsewhere, the established order is in retreat. French President Francois Hollande said last week he would not seek re-election next year, and even German Chancellor Angela Merkel looks vulnerable as she seeks a fourth term in 2017.

Renzi’s departure reflects this shift in the leadership of the Western world. Of the five leaders of the biggest Western economies at the beginning of 2016, only one - Merkel - is likely to still be in power through 2017.