The leader of Italy’s centre-left Democratic party (PD) has warmed to a potential alliance with its long-time rival, the anti-establishment Five Star Movement (M5S), in an attempt to stave off snap elections that threaten to create western Europe’s first fully far-right government since the second world war.

Nicola Zingaretti, who was elected PD party leader in March, relented to the prospect of forming a government with M5S on condition it lasts until the end of the legislature in 2023. “A possible new government must be a turning point, lasting the term, or it is better to go to the polls,” he said after a meeting with PD members on Wednesday morning.

Zingaretti had previously said that such a move would be “a gift to the dangerous right”. His change of heart came after the Italian president, Sergio Mattarella, gave his country’s political parties two days to carve out an alternative government majority after Giuseppe Conte resigned as prime minister on Tuesday, prompting a new wave of political turmoil.

Conte ended the stormy 14-month alliance between the far-right League and M5S after the League’s leader, Matteo Salvini, declared the partnership unworkable earlier this month as he manoeuvres to exploit his rising popularity and bring about snap elections.

Mattarella will begin consultations with the various parliamentary groups on Wednesday afternoon, followed by meetings with leaders of each of the main parties on Thursday.

The idea of an M5S-PD alliance was spearheaded by the PD senator and former prime minister Matteo Renzi, and began to look more plausible when the two parties thwarted Salvini’s calls for an immediate vote of no confidence in Conte. The prospect of the two parties forming an alternative majority has infuriated Salvini. “Who would an M5S-PD executive represent?” he said on Tuesday.

Facebook Twitter Pinterest Matteo Salvini is hoping to force elections to capitalise on his current popularity Photograph: Antonio Masiello/Getty Images

The League is Italy’s biggest party, polling at about 38%, but it is much weaker in the Italian parliament following a third-place showing behind M5S and the PD in March 2018 elections, when it took 17% of the vote.

The two parties, however, would need to overcome myriad difficulties for the plan to become reality. A source said there was still some resistance from Zingaretti, while the M5S leader, Luigi Di Maio, said a deal would only work without Renzi’s involvement.

“We encouraged Zingaretti to try to construct a serious, long-term government with M5S, and some points were programmed,” the source added. “The impression was more positive … he will probably speak to Di Maio in the next few hours, although he is still a bit resistant. He prefers to go to elections and the moves made by Renzi have made him feel a bit overridden as leader.”

That Mattarella has given parties so little time to negotiate may also be a sign that a link-up between M5S and PD is his least preferred option. “Cooking such a deal in two days is an uphill struggle,” Policy Sonar, a Rome-based political consultancy, said in a note. “We maintain that Sergio Mattarella is not a fan of a M5S-PD deal ‘at any cost’.”

Massimiliano Panarari, a politics professor at Luiss University in Rome, said: “There is an interest in parts of the M5S and PD, above all Renzi, to waste time for different reasons. Di Maio needs time to try and stay in the game, while Renzi needs time to aggregate numbers in parliament. This is exactly what Mattarella doesn’t want.”

The most plausible option for Mattarella may be to install a caretaker government to draft Italy’s budget for 2020 and prevent a VAT increase, before calling new elections in either October or November.

The League could team up with Brothers of Italy, a party with a neofascist lineage, to guarantee a majority in any snap election. Salvini has said his supporters would take to the streets if elections were not forthcoming.

“Mattarella is concerned by what the League represents in cultural terms, such as xenophobia,” Panarari said. “But if there is no possibility of a strong alternative government, then he also thinks that elections are the best way, as the most important thing is that the population expresses its voice.”

Renzi’s reappearance has given Salvini the perfect enemy for his electoral campaign. The former prime minister, who was forced to quit after a failed referendum on constitutional reform in December 2016, is seen as the symbol of the traditional politics that Salvini’s supporters despise.