JERUSALEM (Reuters) - "He's a magician, he's a magician," the partisan crowd chanted as a beaming Benjamin Netanyahu strode into his party headquarters a little over a year ago to declare a come-from-behind victory in Israel's election.
Now, with the expected entry into his right-wing government of ultranationalist Avigdor Lieberman as defense minister, it looks like Netanyahu, in his fourth term as premier, has pulled off another piece of political sleight of hand worthy of a "House of Cards" script.
In a matter of hours on Wednesday, Netanyahu crushed the opposition, shored up his support in his narrow, rightist coalition and put himself more firmly on course to become Israel's longest-serving leader.
But Netanyahu's surprise pact with Lieberman's Yisrael Beitenu party, widely expected to be finalised by the weekend, and dashing talks with the center left was already raising Palestinian and international concern.
Lieberman, a settler in the occupied West Bank, has stirred controversy by questioning Palestinian President Mahmoud Abbas's commitment to peace and the loyalty of Israel's Arab minority, while pushing for stonger military action against Gaza's Hamas rulers.
"It's already an extremist government and now it will get even more extreme. This government will block any horizon for peace," said Wasel Abu Youssef, a member of the executive committee of the Palestine Liberation Organization.
An Egyptian official, who spoke on condition of anonymity, told Reuters: "We're shocked, we're really shocked." He noted that the Lieberman appointment came just a day after a speech by Egyptian President Abdel Fattah al-Sisi promised Cairo's help to try to end the Israeli-Palestinian conflict.
At home, questions were raised about whether Lieberman, a former foreign minister who once proposed bombing Egypt's Aswan dam, had the temperament or qualifications to replace ex-general Moshe Yaalon as defense chief of a country that has largely lived by the sword since its creation in 1948.
"I hope Lieberman lives to 120, but I think that even if he does, he will not gain the prowess, knowledge and experience that Yaalon has. These kind of chances should not be taken," former Defence Minister Moshe Arens told Army Radio.
It had appeared for the past days that Netanyahu and Isaac Herzog's center-left Zionist Union party, which has 24 lawmakers, were closing in on an alliance that would put a more moderate face on the government and bolster its one-seat majority in the 120-member parliament.
But in a surprise move, Lieberman, who declined to join the government straight after the 2015 election, convened a news conference on Wednesday to say he was now ready to negotiate an agreement that would bring his party's six lawmakers into the coalition.
Soon, Lieberman's car was pulling up to the prime minister's office, where the two - who have a history of testy relations - launched talks expected to be wrapped up before the weekend.Netanyahu met Lieberman's demand to be named defense minister, political sources said.
Herzog swiftly curtailed his own negotiations and said that bringing Lieberman in would result in government policies "on the brink of madness". Herzog's future is now uncertain.
Political commentators have predicted his days as head of the Zionist Union are numbered, especially after many of the party's legislators warned against negotiating with Netanyahu and threatened not to support any partnership with his Likud party.
For Netanyahu's current far-right coalition partner, the Jewish Home party, the prime minister's expected ousting of Yaalon could not come soon enough.
A Likud member, Yaalon drew criticism from ultranationalists and his own party for backing the military's decision to prosecute a soldier who shot dead a wounded Palestinian attacker in the occupied West Bank in March.
Laying out the welcome mat, Justice Minister Ayelet Shaked of Jewish Home, said: "Avigdor Lieberman is part of the nationalist camp, and I think the coalition, together with him, with 67 legislators will hold together until 2019," when Israel's next election is due.
If Netanyahu remains in office until the end of July 2019, he will be Israel's longest serving prime minister.
(Additional reporting by Dan Williams and Ali Sawafta; Editing by Luke Baker and Alison Williams)