Democratic party leader quits after both candidates he backed for presidency fail to garner enough votes in secret ballots

The chaos gripping Italian politics deepened on Friday night as centre-left leader Pier Luigi Bersani announced his imminent resignation, lashing out at a rebellion which saw off both his candidates for president and exposed the deep divides within his party.

An angry and bitter Bersani told MPs he would stand down as leader of the Democratic party (PD) as soon as parliament managed to elect a new head of state – a contest that is crucial in deciding how and if Italy can extract itself from political gridlock.

The dramatic announcement came after the two men the PD head had backed for president – former union leader Franco Marini and two-time prime minister Romano Prodi – failed to attract the necessary number of votes in ballots.

Although his name had been greeted enthusiastically by many on the centre-left on Friday morning, Prodi, a former president of the European Commission, only managed to get 395 votes in the secret ballot, far below the 504 needed.

"Among [our MPs], one in four betrayed us," Bersani said, according to the Ansa news agency, denouncing "forces trying to destroy the PD".

The move spells an unclear future for the centre-left party, which in February's inconclusive election won an outright majority in the lower house of parliament but not in the upper house, or senate.

Bersani's most consistent and popular leadership challenger has been Matteo Renzi, the 38-year-old mayor of Florence who fought him in primaries last year. Renzi had been the most high-profile critic of Marini's candidacy, which had been agreed with Silvio Berlusconi's centre-right Freedom People (PdL) as part of a cross-party deal. He had, however, backed Prodi for head of state. Bersani's resignation also brings yet more uncertainty to Italy as a whole, which is still being run – in caretaker fashion – by Mario Monti's technocratic government appointed in the wake of Berlusconi's resignation in late 2011.

Bersani, 61, had been trying to form a government since the end of February, but had spurned Berlusconi's offer of a grand coalition and been spurned in turn by the newly powerful Five Star Movement led by erstwhile comedian Beppe Grillo.

Some observers said on Friday that his resignation could increase the possibility of snap elections. After eight bruising weeks in which Bersani's leadership credentials were under fire from figures both in and outside of the PD, the fiasco of the presidential election proved the straw that broke the camel's back.

"He accepted his responsibility after the disgrace of what happened," Paolo Gentiloni, a senior Democratic party parliamentary deputy said after Bersani's announcement.

On Thursday, Marini's candidacy was torpedoed despite the apparent cross-party consensus. On Friday night Prodi said he was withdrawing from the race after his candidacy also failed to muster sufficient support in the fourth ballot.