(Reuters) --- A last-gasp legal challenge by Israeli Prime Minister Benjamin Netanyahu to thwart a bid by a rival rightist to head a new government was rejected on Tuesday as his opponents raced to seal a pact that would unseat him.
Naftali Bennett, Netanyahu's former defence minister, announced on Sunday he would join a proposed alliance with centrist opposition leader Yair Lapid, serving as its premier first under a rotation deal.
They have until Wednesday midnight (2100 GMT) to present a final pact to Rivlin, who handed Lapid the task of forming a new government after Netanyahu failed to do so in the wake of a close election on March 23.
Hoping to beat the deadline, Lapid, Bennett and other party leaders convened to clinch coalition agreements, sources briefed on the talks said.
In a letter to the legal counsels of the presidency and parliament, Netanyahu's conservative Likud said Lapid was not authorised to cede the premiership to Bennett.
But President Reuven Rivlin's office said in response that there was no legal merit to Likud's claim because Lapid would be sworn in as "alternate prime minister", second to serve as premier as part of the rotation.
It accepted Likud's argument that Lapid must provide the president with full details of the new government and not just announce that he has clinched a coalition deal.
The Lapid-Bennett power-share may include other rightist politicians as well as liberal and centre-left parties. Israeli media have speculated it could also court parliamentary backing from a party that draws votes from Israel's Arab minority.
That has prompted Netanyahu to accuse Bennett of imperiling Israel as it contends with internal Jewish-Arab strife over last month's Gaza conflict, the moribund peace process with the Palestinians, and Iran.
DIVIDED COUNTRY
Netanyahu, 71, is the dominant political figure of his generation. He was first elected prime minister in 1996 and he returned to power in 2009, holding the top office for more than a decade. But he also faces a corruption trial for bribery, fraud and breach of trust - charges he denies.
A photo-shopped picture of Bennett in an Arab headdress, circulated on social media, prompted comparisons with attempts to discredit former Prime Minister Yitzhak Rabin, assassinated in 1995 by an ultranationalist opposed to his peacemaking.
An Israeli security source said Bennett had received parliamentary bodyguards on the recommendation of the Shin Bet domestic intelligence agency due to the "atmosphere of incitement" against them.
Lapid and Bennett have said they want to bring together Israelis from across the political divide and end hateful political discourse.
"A country that is divided and violent won't be able to deal with Iran or with the economy. A leadership that incites us against one another harms our ability to deal with the challenges we face," Lapid said.