Israel's parliament has voted to dissolve itself, sending the country to an unprecedented second snap election this year as Prime Minister Benjamin Netanyahu failed to form a governing coalition before a midnight deadline.

Parliament voted early Thursday 74-45 to disperse and call new elections.

The dramatic vote, less than two months after the most recent parliamentary election, marked a setback for Netanyahu and sent the longtime leader's future into turmoil.

Netanyahu, who has led Israel for the past decade, had appeared to capture a fourth consecutive term in the April 9 elections. But infighting among his allies, and disagreement over proposed bills to protect Netanyahu from prosecution stymied his efforts to form a majority coalition.

"I didn't spare any effort to avoid unnecessary elections," Netanyahu said after the vote, lashing out at his ally-turned-rival, Avigdor Lieberman, who refused the prime minister's offers to join the government.

Had the deadline passed without the vote, Israel's president would have given another lawmaker, most likely Opposition leader Benny Gantz, an opportunity to put together a coalition.

After the vote, Gantz angrily accused Netanyahu of choosing self-preservation over allowing the country's political process to run its course. Gantz said Netanyahu opted for "three crazy months" of a new campaign and millions of wasted dollars over new elections because he is "legally incapacitated" by looming indictments.

"There is no other reason," Gantz said.

The country now plunges into a new election campaign that will last at least three months under Israeli law. With much of the country on vacation in late August, a tentative date of Sept. 17 was set.

A man hangs a poster of Netanyahu in Jerusalem during the April 2019 election campaign. Israelis are expected to head to the polls for a second vote on Sept. 17. (Susan Ormiston/CBC)

The campaign looks to complicate Netanyahu's precarious legal standing. Israel's attorney general has recommended pressing criminal charges against him in three separate corruption cases, pending a hearing scheduled for October.

Even if Netanyahu wins the election, it is unlikely he will be able to form a government and lock down the required political support for an immunity deal before an expected indictment. That would force him to stand trial and put heavy pressure on him to step aside.

The political uncertainty could also spell trouble for the White House's Mideast peace efforts. The U.S. has scheduled a conference next month in Bahrain to unveil what it says is the first phase of its peace plan, an initiative aimed at drawing investment into the Palestinian territories.

But with the Palestinians — who accuse the U.S. of being unfairly biased toward Israel — opposed to the plan, and Netanyahu preoccupied with re-election, it remains unclear how the Americans will be able to proceed. U.S. President Donald Trump's top Mideast adviser, his son-in-law Jared Kushner, was in Israel and scheduled to meet with Netanyahu on Thursday.

Talks failed Wednesday to find a compromise that would allow Avigdor Lieberman's Yisrael Beiteinu faction to join Netanyahu's right-wing coalition. (Ronen Zvulun/Reuters)

That Netanyahu struggled to secure a majority coalition in the 120-seat parliament was a shocking turn of events for the country's dominating political figure. In the April 9 vote, Netanyahu's Likud party and its hardline nationalist and religious parties captured a majority of 65 seats.

The immediate cause of the crisis was Netanyahu's dispute with Lieberman, a former aide who leads the small Yisrael Beiteinu faction. The men had clashed over Lieberman's demand to subject ultra-Orthodox religious males to the military draft, which is compulsory for most Jewish males.

Without Lieberman's five parliamentary seats, Netanyahu had no majority. But the deeper issue is connected to Netanyahu's legal troubles.

Facing a likely indictment, he had pushed his coalition partners to pass legislation that would grant him immunity and curb the powers of the country's Supreme Court. Opposition parties strongly oppose granting Netanyahu immunity, robbing him of any alternatives to Lieberman as he tried to form a coalition.

Secular versus orthodox agendas

Though a staunch nationalist, Lieberman also champions a secular agenda aimed toward his core political base of immigrants from the former Soviet Union and has pledged to confront efforts of the ultra-Orthodox parties to impose their lifestyle on the country's secular majority.

"I am not against the ultra-Orthodox community. I am for the state of Israel. I am for a Jewish state but against a Halachic state," Lieberman wrote on Facebook early Wednesday, using a term that refers to a Jewish state governed by Jewish law.

The ultra-Orthodox parties consider conscription a taboo, fearing that military service will lead to immersion in secularism, and insist the exemptions stay in place. Netanyahu, dependent on their political support, says they have compromised enough and is refusing to press them further.

Netanyahu maintained contacts with Lieberman and other parties in hopes of forging a deal as a parliamentary debate took place. Many of the Likud speakers lashed out at Lieberman, accusing him of forcing an unnecessary election.

But as a parliamentary debate stretched toward midnight, it became clear there would be no compromise.

A bitter Netanyahu claimed after the vote that Lieberman "had no intention" to compromise and made unrealistic demands.

"He is dragging the entire country for another half a year of elections," he said.