It appears the magician has finally run out of tricks.

The opponents of Israeli Prime Minister Benjamin Netanyahu announced Wednesday that they had reached an agreement to form a government and oust him from office, in all likelihood spelling the end of the veteran leader’s 12-year grip on power.

Centrist lawmaker Yair Lapid said in a statement that he had informed Israeli President Reuven Rivlin he had succeeded in forming a coalition government with Naftali Bennett, a former defense minister and onetime Netanyahu ally, as well as other parties.

“The government will do everything it can to unite every part of Israeli society,” Lapid said to Rivlin.

June 2, 202101:41

Bennett, a former settler leader who shares many of Netanyahu’s hard-line views and heads the small religious Yamina party, is due to serve as prime minister for two years before handing over the reins to Lapid for two more.

Lapid, a former broadcast journalist, leads Israel’s second-largest party, Yesh Atid, but was unable to cobble together enough seats without Bennett’s hard-line nationalist Yamina party.

The coalition deal still has to be voted on by the Israeli Parliament, but is expected to pass some time in the next few weeks.

The deal between Israeli lawmakers Yair Lapid, left, and Naftali Bennett comes after the two leaders agreed to work together on Sunday.Uriel Sinai / Getty Images file

Announced just minutes before the deadline for the opposition parties to strike a deal, however, the fragile nature of the agreement will give Netanyahu some hope he can scupper it before the crucial parliamentary vote.

But this nonetheless represents a significant breakthrough for his opponents after more than a decade of Netanyahu’s dominance over Israeli politics and less than two weeks since he presided over a cease-fire following the country’s latest conflict with the Palestinian militant group Hamas in Gaza.

The new government will be made up of a diverse constellation, folding together dovish left-wing parties with right-wing nationalists in an unlikely coalition that speaks to a desperation felt by many Israeli lawmakers across the political spectrum to block Netanyahu’s path to a further stint in office.

Download the NBC News app for breaking news and politics

Netanyahu, Israel’s longest-serving prime minister, has displayed an unrivaled ability to cling to power through conflict, corruption charges and countless elections.

Long a polarizing figure, he has found himself increasingly isolated since he was indicted on charges of fraud, breach of trust and bribery in late 2019. He has been on trial since last year, and has alienated many former allies and supporters, who have run against him in recent elections.

But while his rivals have spent the past few days frantically finalizing their deal to oust him before a late Wednesday deadline, Netanyahu, 71, has berated what he called a “con government” and done everything he can to prevent it from taking office.

He has also welcomed a number of Republican lawmakers from the U.S. to his office in Jerusalem, a sign of his continued support from the American right.

Netanyahu has been desperate to stay in power while on trial, but his critics say he should not be able to serve while indicted. It’s possible that a new coalition government could try to block a lawmaker who is under indictment from running for the premiership.

The coalition government will also include an Arab Islamist party, the United Arab List. Despite Arabs representing around 20 percent of Israel’s population, an Arab party has never before joined an Israeli coalition government.

It remains unclear how a new coalition government with such disparate views and interests will be able to govern successfully.

Meanwhile, Isaac Herzog, a veteran politician and the scion of a prominent Israeli political family, was elected president Wednesday. The role is largely ceremonial but is meant to promote unity inside Israel.

Herzog, a center-left politician, is a former head of Israel’s Labor Party — home to the founding leaders of Israel and the party that later signed the landmark Oslo peace accords with the Palestinians.

Many in Israel will be hoping that the Bennett-Lapid deal can end the political deadlock that has plagued the country and led to four elections in the past two years. Each of the votes were seen as a referendum on Netanyahu’s fitness to govern and each ended in deadlock.

In the latest vote held on March 23, Netanyahu’s Likud party won the most seats, but failed to secure a majority of 61 in Israel’s 120-seat Knesset, or Parliament. No party in Israeli history has won an outright majority in the Knesset, making coalitions a fact of political life.

Handed a chance to cobble together a coalition government, Netanyahu failed to muster enough support to cross the 61-seat threshold. He even tried to court the United Arab List despite having vilified Israeli Arab voters in previous elections.

While the formation of a new “change” government would deal Netanyahu a symbolic and legal blow, it would not necessarily spell the end of his political career. After all, he has lost the premiership before only to come back.

Paul Goldman and Cassandra Vinograd contributed.

CONTACT US

We're not around right now. But you can send us an email and we'll get back to you, asap.

Sending

Log in with your credentials

Forgot your details?