JERUSALEM — A diverse group of opposition lawmakers notified Israeli President Reuven Rivlin on Wednesday that they have agreed on the terms of a power-sharing government that would replace Benjamin Netanyahu as prime minister for the first time in 12 years.

The step sets up a vote on the arrangement by Israel's full parliament, probably within a week to 12 days.

Former defense minister Naftali Bennett would replace Netanyahu, his former mentor, as prime minister for a term of two years, according to the official notification. After that, centrist opposition leader Yair Lapid would take the top spot.

Those two party leaders had been on the verge of securing a majority coalition to unseat Netanyahu when hostilities erupted last month between Israel and Hamas. While some political observers initially said the prime minister would benefit from the fighting and might be able to fend off the opposition challenge, negotiations between Lapid and Bennett again accelerated after the cease-fire, and Bennett said Sunday that he was ready to join the anti-Netanyahu coalition.

Rivlin's office said Lapid delivered the official notification at 11:22 p.m., reaching the president at a soccer game 38 minutes before Lapid's window to negotiate a coalition was due to expire.

“I congratulate you and the heads of the parties on your agreement to form a government,” Rivlin said in his response to Lapid. “We expect the Knesset will convene as soon as possible to ratify the government, as required.”

Lapid reported to Rivlin that the coalition of small parties has enough votes to win a narrow majority in the 120-seat parliament, called the Knesset. The parliamentary vote will be scheduled by Speaker Yariv Levin, a member of Netanyahu's Likud party. Levin is expected to delay the process until the last moment to give his faction more time to exploit tensions within the fledgling coalition and derail the deal. Legal experts said the vote probably will occur within 12 days.

The governing coalition now poised to take power in Israel is an ideological mix — many would say mess — of factions that range from religiously oriented advocates of Jewish settlements in the West Bank to secular supporters of an independent Palestinian state.

But there is one thing they all agree on: It is time for Netanyahu to go.

This new government would be the anti-Netanyahu government. The organizing principle of the “change coalition” is the assertion that the prime minister’s dogged push to keep his office after four inconclusive elections is harming the country.

“Over the past 30 months, the State of Israel has been in chaos, with one election campaign after another. This political crisis is unprecedented,” Bennett said after announcing he would join the coalition.

Netanyahu, who was indicted on charges of bribery, fraud and breach of trust in 2019 and has been on trial for a year, has waged a scorched-earth campaign against prosecutors and judges. He dissolved parliament in 2018 rather than let rivals have a chance to form a government. He has railed against lawmakers wanting to replace him as leftist radicals, raising fears of political violence harking back to the 1995 assassination of Prime Minister Yitzhak Rabin by a right-wing Jewish nationalist.

Bennett said he was joining the anti-Netanyahu forces to “stop the madness.”

Several of the coalition leaders are former Netanyahu allies who share many, if not most, of his hawkish views. They say, however, they can no longer share a government with him because of their personal experience with his record of breaking promises, humiliating partners and sidelining potential rivals.

Several also have been fired over the years from cabinet jobs by Netanyahu, including Bennett and Lapid, the opposition leader. Netanyahu’s former chief lieutenant Avigdor Liberman, who now heads his own party, says it is “unclear” whether Netanyahu “is 100 percent mentally fit.”

Benny Gantz, the current alternate prime minister and defense minister, was slammed by many of his own voters when he joined Netanyahu’s emergency unity government last year, only to say later that he regretted doing so because of the prime minister’s broken pledges. Gantz has agreed to join the new government.

And Gideon Saar, one of several former members of Netanyahu’s Likud who left the party in protest of the prime minister’s actions, said replacing his former mentor has become “a national priority.”

Netanyahu’s history with those seeking to assemble the new governing coalition may explain their reaction to his recent attempts to woo some of these lawmakers back to his camp. His increasingly lavish offers of shared power and rotating prime minister roles have been met with one hard no after another.

“No one believes a word he says. Why would they?” said Jonathan Rynhold, professor of political studies at Bar-Ilan University. “Part of it is personal with these people who know him. And part of it is that all of them have come to believe that Mr. Netanyahu has put his personal interests ahead of the interests of the State of Israel because he can no longer distinguish between the two.”

Rynhold describes Netanyahu’s willingness to break rules and attack institutions as a departure even from Israel’s rough-and-tumble politics. Eventually, Rynhold said, the prime minister’s behavior united the country’s fractious political spectrum, with lawmakers of many stripes vowing to end a political crisis that has seen Israelis forced to vote in four elections in just two years.

“It’s nothing to do with policy or ideology at this point. It’s character,” Rynhold said.

Few national politicians have had a relationship with Netanyahu more complex and tumultuous than Bennett, who first entered politics 15 years ago as his chief of staff. Bennett, along with his second-in-command, Ayelet Shaked, helped transform Netanyahu from leader of the opposition to prime minister.

Bennett named his first son after Netanyahu’s brother Yoni, who died in the famed 1976 raid in Entebbe, Uganda, to free more than 100 Israelis taken hostage by Palestinian hijackers.

But in 2008, both Bennett and Shaked abruptly abandoned their positions at Netanyahu’s side. Although they refused to officially explain their departure, it was widely reported in the Israeli media that the two had run afoul of Netanyahu’s wife, Sara.

When Bennett returned to the Knesset in 2013 as head of the pro-settler Jewish Home party, Sara Netanyahu submitted a handwritten request to Israeli authorities asking for damaging intelligence on Bennett and his wife, Gilat, according to Israel’s Channel 12. Another Channel 12 report said Benjamin Netanyahu pushed for a smear campaign against the Bennett family with a series of articles on the Israeli news site Walla, including one about Gilat Bennett working as a pastry chef at a non-kosher restaurant.

Netanyahu’s alleged manipulation of his friendship with the site’s former owner is now at the center of one of the corruption cases against the prime minister. The Netanyahus have denied any wrongdoing.

Despite the acrimony, Bennett served under Netanyahu as economy and religious services minister from 2013 to 2015 and as education minister from 2015 to 2019. In that year, Netanyahu fired him and Shaked, who was justice minister, without explanation.

Now Bennett is on the cusp of replacing his former boss, leading a bare-majority government that would include left-wing members and the Islamist party, Ra’am. A photograph of Ra’am leader Mansour Abbas signing the coalition agreement at a table with Bennett and Lapid — marking the first time an Arab party has joined an Israeli governing coalition — circulated widely in Israel.

Political observers say a government composed of such diverse members may be forced to bypass controversial issues, such as reviving peace negotiations with the Palestinians or expanding settlements in occupied territories. Instead, conservative and liberal parties are likely to focus on a consensus agenda of improving the economy, health care and education.

“It may be that they can finally take a more national view,” Rynhold said. “At the end of the day, they are all pragmatic.”