Rivlin announced his decision on live television Wednesday, a day after Netanyahu failed to create a governing coalition by a midnight deadline. After consulting with all parties elected to Israel’s parliament, Rivlin said he believes Lapid has the best chance of forming a coalition.

“It is clear that Knesset member Yair Lapid has a chance to form a government that will earn the confidence of the Knesset, even if the difficulties are many,” he said.

Netanyahu’s failure to assemble a ruling coalition in the four weeks allotted to him led many to question his political future and raised the possibility that his 12-year run as prime minister, the longest in Israeli history, could soon come to an end.

“It looks like, perhaps within a few days or a few weeks, we might have a functioning coalition that will not include Mr. Netanyahu. This will be a groundbreaking change,” said Yohanan Plesner, president of the Israel Democracy Institute, an independent think tank.

He acknowledged, however, that “a fifth consecutive election is still, unfortunately, a real possibility.”

For more reporting from the Associated Press, see below.

Lapid, whose late father was a Cabinet minister and who himself is a veteran journalist and politician, now has four weeks to reach a deal with potential partners.

While Lapid faces a difficult task, he now has the chance to make history by ending the reign of Netanyahu, Israel’s longest-serving prime minister. Netanyahu has held the post for a total of 15 years, including the past 12.

Rivlin met with the two main candidates for forming a government—opposition leader Lapid and Naftali Bennett, a former Netanyahu ally—and asked parties to make their positions known by early afternoon.

Lapid, who heads the centrist Yesh Atid party, received the backing of four smaller parties from across the political spectrum, while Bennett, head of the small nationalist and religious Yamina party, recommended himself to form the next government.

Addressing reporters later, Bennett, a former Netanyahu ally, accused the prime minister of “slamming the door” in his face and vowed to seek the formation of a broad government spanning the political spectrum. He said everything must be done to avert another election.

“This is the time to form a unity government,” he said. “The door is open to all parties.”

“I can’t promise we will succeed in forming such a government,” he added. “I do promise we will try.”

Elections held March 23 ended in deadlock for the fourth consecutive time in the past two years. Despite repeated meetings with many of his rivals and unprecedented outreach to the leader of a small Islamist Arab party, Netanyahu was unable to close a deal.

Rivlin gave Netanyahu the first chance to form a coalition after 52 members of parliament endorsed him as prime minister last month. That was short of a majority, but the highest number for any party leader.

During Wednesday’s consultations, the 52-member pro-Netanyahu bloc asked Rivlin not to give another candidate a chance to form a government and instead send the matter directly to parliament.

In a statement, Likud claimed there was no viable combination for an alternative coalition and that prolonging the negotiating process was a waste of time. Moving straight to parliament, it said, “will save another period of uncertainty for the state of Israel.”

Despite the Likud’s plea, Lapid, who received the backing of 45 lawmakers, now seems to be the most likely candidate to get a chance to form a government. Bennett controls just seven seats in parliament, but he has emerged as a kingmaker of sorts by carrying the votes Lapid would need to secure a parliamentary majority.

Lapid has said he is ready to share the prime minister’s job with Bennett, with Bennett serving first in a rotation. But they have not reached any firm agreements. The parties opposed to Netanyahu represent a wide range of conflicting ideologies, making it unclear whether they will be able to unite.

“Players from the right wing, from the center, from the left will have to build a common agenda,” Plesner said. “Their strong driving force would be to stay in government to ensure that Netanyahu is out and that the affairs of state are properly run.”

Netanyahu has become a divisive figure in Israeli politics, with the last four elections all seen as a referendum on his rule. He has been desperate to remain in office while he stands trial, using his position to lash out at prosecutors and seek possible immunity from prosecution.

Netanyahu has been charged with fraud, breach of trust and bribery in a series of scandals. The trial has moved into the witness phase, with embarrassing testimony accusing him of trading favors with a powerful media mogul. Netanyahu denies the charges, accusing law enforcement, the judiciary and the media of waging a “witch hunt” against him.