Israeli politicians battling to unseat veteran right-wing Prime Minister Benjamin Netanyahu were locked in last-ditch talks on Wednesday to hammer out their "change" coalition composed of bitter ideological rivals.
They have until the end of the day -- 11:59 pm (2059 GMT) -- to cobble together an administration that would end 12 straight years of rule by the hawkish heavyweight, Israel's longest-ruling premier.
But they were expected to announce the new line-up before the midnight deadline as parliament meets at 11:00 am to vote on a new president for the country, a largely honorary position.
The high-stakes push for a government is led by former television presenter Yair Lapid, a secular centrist who on Sunday won the crucial support of hardline religious nationalist Naftali Bennett.
"The coalition negotiation team sat all night and made progress toward creating a unity government," a Bennett spokesman said in a statement.
But to reach a majority in the 120-seat Knesset, their unlikely alliance would also have to include other left and right-wing parties -- and would probably need the support of 1948 Arab politicians.
That would result in a government riven by deep ideological differences on flashpoint issues such as Jewish settlements in the Israeli-occupied West Bank and the role of religion in politics.
Lapid, leader of the Yesh Atid party, was tasked with forming a government by President Reuven Rivlin after Netanyahu again failed to put together his own coalition following Israel's fourth inconclusive election in less than two years.
Lapid has reportedly agreed to allow Bennett, a tech multi-millionaire who heads the Yamina party, to serve first as a rotating prime minister in a power-sharing agreement, before swapping with him halfway through their term.
Late Tuesday, a source close to the talks told AFP negotiators were hammering away to "finalise a deal as soon as possible".
Lawmakers were to vote Wednesday in a secret ballot for one of two candidates to replace Rivlin and become their country's 11th president since the creation of Israel in 1948.
The first candidate is Myriam Peretz, 67, a settler and former headmistress widely known as "the mother of sons" after she lost two of her six children while officers in the Israeli army.
The second, 60-year-old Isaac Herzog, is a former leader of the centre-left Labor party and minister from a prominent Tel Aviv family who supports two-state solution with the Palestinians.
Israel's latest political turmoil adds to the woes of Netanyahu, who is on trial for criminal charges of fraud, bribery and breach of trust while in office -- accusations he denies.
If he were to lose power, he would not be able to push through changes to basic laws that could give him immunity, and would lose control over certain justice ministry nominations.
The last-minute talks also follow a flare-up of fighting between Israel and Palestinian militants in the Gaza Strip, which ended after 11 days of deadly violence with an Egyptian-brokered ceasefire on May 21.
Netanyahu, who served an earlier three-year term in the 1990s, had warned on Sunday of "a left-wing government dangerous to the state of Israel".
The premier, who heads the Likud party and has developed a reputation as a wily political operator, was scrambling to scupper the new alliance.
Likud's lawyers on Tuesday tried to hobble the emerging coalition by challenging Bennett's right to serve first as prime minister, given that it was Lapid who was charged with forming the government.
But the legal adviser to Israel's president dismissed the challenge.
1948 Arabs support?
In order to build the anti-Netanyahu bloc, Lapid must sign individual agreements with seven parties, whose members would then vote in parliament to confirm their coalition.
They include the hawkish New Hope party of Netanyahu's former ally Gideon Saar and right-wing secular nationalist Avigdor Lieberman's pro-settlement Yisrael Beitenu party.
The centrist Blue and White party of Defence Minister Benny Gantz, the historically powerful Labor party and the dovish Meretz party would also join.
If all those parties indeed sign on, the emerging alliance still needs the backing of four more lawmakers.
For that, Lapid is counting on parties representing Palestinian citizens of Israel, which have yet to announce their intentions.
Mansour Abbas, head of the Islamic conservative Raam party, which has four seats, has generally voiced openness to any arrangement that improves living conditions for Israel's 20 percent Palestinian Arab minority.
Abbas told reporters Tuesday that negotiations appeared to be heading "in a good direction".
But, he said: "until it's finished, nothing is finished."