Italy's president has tapped politically inexperienced law professor Giuseppe Conte to be the man who will head Italy's first populist government.
Italy's anti-establishment parties revived their coalition plans, ending three months of political turmoil by announcing a government that promises to increase spending, challenge European Union fiscal rules and crack down on immigration.
The coalition deal, following inconclusive elections in March, removes the risk of a repeat vote, a prospect that had sparked a big selloff in Italian financial markets this week.
The leaders of the right-wing League and the 5-Star Movement patched up their alliance after agreeing to substitute a eurosceptic they had initially proposed as economy minister, a nomination that had been rejected by the head of state.
"All the conditions have been fulfilled for a political, 5-Star and League government," 5-Star chief Luigi Di Maio and League leader Matteo Salvini said in a joint statement after several hours of talks in central Rome.
Just a few hours later their chosen prime minister Mr Conte, a little-known law professor who belongs to neither party and has not been elected, presented his list of ministers after receiving his second mandate in eight days.
"We will work with determination to improve the quality of life of all Italians," Mr Conte told reporters at the presidential palace after meeting the head of state Sergio Mattarella.
Mr Salvini will be the interior minister and Mr Di Maio will take a powerful, newly-created joint ministry made up of the labour and industry portfolios.
Both leaders will also be deputy prime ministers and many commentators have forecast that Mr Conte will have a tough time proving he can be more than a puppet in the hands of his powerful political sponsors.
His ministers will be sworn in on Friday before the government faces votes of confidence in both houses next week.A rollercoaster week in Italy
The deal followed an extraordinary few days in which Mr Di Maio called for Mr Mattarella to be impeached, Mr Conte and another prime minister-designate were tasked to form a government and failed, before Mr Conte was reinstated on Thursday evening.
Mr Mattarella even took the step of appointing former International Monetary Fund official Carlo Cottarelli as an interim prime minister until a re-election.
The breakthrough came after the League and 5-Star agreed to drop economist Paolo Savona as their choice for economy minister.
Mr Savona, an 81-year-old economist, had said previously that Italy should have a contingency plan to abandon the euro.
He will be substituted by economics professor Giovanni Tria, another little-known figure.
Mr Savona will be in government as European affairs minister, a less powerful role but one which will still allow him to negotiate with Brussels and speak on EU issues.
No sooner had the coalition deal been announced than friction flared with Brussels over remarks by European Commission chief Jean-Claude Juncker about Italy's impoverished south.