Luigi Di Maio took the anti-establishment Five Star Movement into government when it became Italy’s biggest party in 2018 elections.
But now that its popularity has dwindled after two successive coalitions he has resigned as leader, saying “an era is coming to an end”.
Voters go to the polls in the northern region of Emilia-Romagna on Sunday in a big test for the government.
Right-wing nationalists there hope to end decades of centre-left rule.
Defeat for the ruling Democratic Party could jeopardise the government, which is made up of both the centre-left and Mr Di Maio’s Five Star.
Although he will stay on as foreign minister, the decision of Mr Di Maio, 33, to step down weakens an already shaky administration.
In his farewell speech at Hadrian’s Temple in Rome, he described Five Star as a “visionary project never achieved before and with no equal anywhere in the world”.
Results would come, he insisted, adding: “We need to have time to sort out the mess made by those in power for the past 30 years.”
Who are Five Star?
Starting out as a vehicle for an anti-establishment ex-comedian called Beppe Grillo, the Eurosceptic party soared in the opinion polls as Italians tired of the political class and corruption and backed a movement promising widespread reform.
Five Star, or M5S as it is known in Italy, is unusual in that it champions digital democracy among its members and puts decisions to an online vote.
It started winning elections, including the mayoral race in Rome. Then Luigi Di Maio took over as leader aged 31 and won the 2018 election with 33% of the vote.
After weeks of talks, Five Star went into coalition with the nationalist League leader Matteo Salvini in June 2018. But as Five Star’s popularity halved, Mr Salvini’s star rose.
In an unsuccessful gamble on triggering new elections, Mr Salvini pulled out of the coalition last August only to see Mr Di Maio’s party go into coalition with the centre-left Democratic Party. Prime Minister Giuseppe Conte, an independent law professor, stayed in his job.
Why did Di Maio go?
Opinion polls paint a worrying picture for Five Star ahead of Sunday’s elections in Emilia-Romagna. The party trails in third place in opinion polls in the wealthy northern region, with Mr Salvini’s League neck-and-neck with the ruling Democratic Party.
Dislodging the centre-left after 75 years as a regional force would be a major achievement for the League.
Five Star has also seen a number of MPs and senators defect, partly because of Mr Di Maio’s leadership.
Mr Di Maio told supporters in Rome that it was a difficult moment for Five Star and it was time for the party to “reinvent itself”.
He attacked the party’s internal critics and insisted that after 20 months in government, it was too early to be judged. That was why it should remain in government. he said.
Five Star will be run by a caretaker leader until it decides on a new figure in a party congress.