(Bloomberg) -- Sergio Mattarella was re-elected as Italy’s president, offering relief to investors by setting up former European Central Bank head Mario Draghi to remain prime minister.

After almost a week of failed votes to elect an alternative candidate, Italy’s deadlocked parliament turned to Mattarella as a last resort to end the political impasse. An interim official count in Saturday’s ballot put the 80-year-old president over the top. It followed a deal between Draghi and Italy’s main parties to back Mattarella. 

Draghi was initially seen as a top contender for the job and made it clear he would be keen to become head of state. The former ECB president was thwarted by lawmakers in his own unity government who feared a return to political turmoil without Draghi at the helm. 

The outcome could provide relief to investors as it reduces the chances of early elections and will let Draghi press ahead with his reform agenda until the next election, due in 2023.

Read More: How Italy Elects a President Through a Papal-Style Vote

Mattarella had said he was keen to retire, going so far as to rent a new apartment in Rome. In the end, it was Draghi who asked Mattarella to remain in office on Saturday, breaking the stalemate. All parties backed the incumbent except Giorgia Meloni’s far-right Brothers of Italy.

Mattarella tapped Draghi to lead the government amid political chaos at the start of the Covid pandemic. Parties across the ideological spectrum agreed to suspend their political jockeying and back Draghi. 

Since his appointment last February, Draghi, 74, has held Italy’s querulous parties together, embarked on a series of economic and administrative reforms, led an aggressive vaccination push and secured 200 billion euros ($223 billion) in European Union Covid recovery funds. 

Read more: Draghi’s Power Ebbs, Signaling Tougher Times for Italy 

His challenge now is to inject fresh energy into his administration, which appeared to lose steam in the weeks before the vote. Still, staying on will give Draghi more say over policy than if he had shifted to the presidency. 

The Italian president has limited powers and the role is ceremonial most of the time. Yet, no one gets to be premier without the president’s approval — they nominate heads of government and their chosen ministers. The president also holds the power to dissolve parliament, which means they can act as a force of stability in crises. 

During his seven-year mandate, Mattarella has appointed four different governments and become a symbol of continuity and stability. He addressed the nation several times during the worst months of the pandemic, even showing he did not get an haircut during the lockdown months, like most Italians.

Born in Palermo in 1941, Mattarella served as cabinet minister in several governments. He has also been a judge on Italy’s Constitutional Court. 

©2022 Bloomberg L.P.