Israeli opposition parties have just hours left to form a new government that would end Benjamin Netanyahu’s 12-year stretch as prime minister.
Yair Lapid of the centrist Yesh Atid party has made several deals ahead of the midnight (21:00 GMT) deadline.
But crucially he is yet to reach a final agreement with the right-wing nationalist politician Naftali Bennett.
Mr Bennett is expected to become the prime minister ahead of Mr Lapid under a rotation arrangement.
Mr Netanyahu and his Likud party have been appealing to fellow right-wing politicians not to join the coalition, knowing that a new government would still face a vote of confidence in parliament before it could be sworn in.
If it fails to win the support of a majority in the 120-seat Knesset, there is a risk of the country having to go to elections for the fifth time in two years.
Opposition leaders said on Wednesday morning that after intense, all-night negotiations they had advanced their efforts to form what is being described as a “government of change”.
Mr Lapid and Mr Bennett were later seen whispering and smiling at a parliamentary session to elect the country’s new president.
Isaac Herzog – a former leader of the centre-left Labour party who currently heads the Jewish Agency, which is responsible for Jewish immigration to Israel – will take over the largely ceremonial role.
Meanwhile, there was a feisty response from Mr Netanyahu when he was asked by a BBC journalist whether this was his last week as prime minister: “is that a wish or a question?” he asked.
As the deadline approached, Israeli media reported that several disagreements were stopping coalition deals being finalised with three parties – Mr Bennett’s Yamina party, the New Hope party of Mr Netanyahu’s former ally Gideon Saar, and the Arab Islamist Raam party.
Raam’s leader, Mansour Abbas, was said to have demanded that the coalition agree to cancel a law that enforces fines on illegal construction that Israeli Arabs say disproportionately targets them.
There was also a disagreement over a position on the Knesset’s judicial appointments committee between Yamina’s deputy leader Ayelet Shaked and the head of the Labour party, Merav Michaeli. Both have offered to rotate the spot, but only if they serve first
No rational political enemy of Benjamin Netanyahu can underestimate his tenacity, ruthlessness and absolute determination to hold on to office. Until a new government with a new prime minister is sworn in, he will do all he can to stop it.
If he found himself leader of the opposition, he would do all he could to destabilise a coalition with a wafer-thin majority that would be trying to span the entire Israeli spectrum, from the nationalist right to the liberal left.
All that unites them is their desire to remove him from office.
Mr Netanyahu has already called the proposed new government the “fraud of the century”. He says it endangers the state of Israel, the people of Israel, and the soldiers of Israel. However loudly he complains, the likelihood is that he is leaving office. In the end his defeat was sealed not by left-wing opponents but by fellow right-wingers he has made into enemies by his ruthless, high-handed tactics.
No-one should expect big, new initiatives from a new government. Just surviving the onslaught Mr Netanyahu is undoubtedly planning will be a full-time job. His opponents will be hoping that his fall will continue in the Jerusalem courthouse where he is already on trial on serious corruption charges.
Mr Lapid has already finalised agreements with Labour, the left-wing Meretz party, the centrist Blue and White party of Defence Minister Benny Gantz, and the right-wing nationalist Yisrael Beitenu party of Avigdor Lieberman.
The eight parties have little in common politically apart from their plan to replace Mr Netanyahu. They say he should not remain in office while standing trial on charges of bribery, fraud and breach of trust in connection with three separate cases. He has denied any wrongdoing.
On Sunday, Mr Netanyahu urged right-wing politicians not to join what he called “a left-wing government” that would be “a danger to Israel’s security and future”
Mr Bennett had earlier accused him of “seeking to take the whole national camp, and the whole country, with him on his personal last stand”.
“Four rounds of elections and [the past] two months proved to us all that there simply is not a right-wing government to be led by Netanyahu. It’s either a fifth election or a unity government,” he said.
The 71-year-old prime minister was given the first chance to form a government after his Likud party won the most seats in March’s inconclusive general election. However, he was unable to do so before his mandate expired last month.
If Mr Lapid does not make Wednesday night’s deadline, the Knesset will have three weeks to agree on a prime ministerial candidate. Otherwise, another general election will be held, continuing a long period of political stalemate.