ISRAELI Prime Minister Benjamin Netanyahu's lacklustre election campaign only got into top gear one hour before polling stations closed.
With bleak grassroots reports flowing into his Likud party headquarters, it was clear that Netanyahu risked being outflanked by a centrist newcomer, setting up the possibility of the biggest electoral upset in Israeli history.
"Go vote. The Likud government is in danger," Netanyahu wrote on his Facebook page. If it sounded as if he was in a panic, it was because he was.
Ever since he had forged an electoral pact with the ultra-nationalist Yisrael Beitenu party back in October, Netanyahu trusted in a slew of opinion polls that predicted he would easily win a third term in office in the Jan. 22 ballot.
The joint ticket ensured he would end up head of the largest single bloc, putting him in pole position to lead the next coalition.
His prime concern appeared to be a slippage of votes to rivals on the far right, which became such an obsession in the final days of campaigning that he forgot to check in his other mirror and see the centrists storming up on the outside.
"He made every mistake possible in the campaign," said Gideon Rahat, a political science professor at the Hebrew University in Jerusalem. "It looks like he will be the next prime minister, but his party has paid the price."
In the end, Likud-Beitenu captured 31 of parliament's 120 seats, just enough to prevent the centre-left from creating a blocking majority but still 11 seats down on the number won by the two parties in the 2009 legislative election.
By contrast, political newcomer Yesh Atid (There is a Future), led by former TV host Yair Lapid, took 19 seats, making it the surprise second-largest party in the next parliament.
In what could become the enduring image of the election, Netanyahu and Lapid, each in his own campaign headquarters, gave simultaneous victory speeches - appearing side-by-side on split screens as equal players in the political arena.
Even Israel Hayom, a free newspaper that is widely seen as a mouthpiece for the Netanyahu government, did not try to hide the pain. "Lapid's surprise, Likud's disappointment," it said.
With the benefit of hindsight, the writing had been on the wall long before the shock of voting day, when the well-oiled Likud electoral machine failed to generate the same sort of voter excitement seen amongst supporters of newer blocs.
The campaign rallies failed to draw big crowds. The party did not even publish a political manifesto, relying on Netanyahu's image as a strongman to carry the day.
"All our lives we voted Likud but today we voted for Lapid because we want a different coalition," said Ahuva Heled, 55, a retired teacher voting on Tuesday in the town of Even Yehuda, north of Tel Aviv. "We want to enable young people to obtain housing and live more peaceful and comfortable lives."
Such sentiments finally filtered through to Netanyahu's inner circle on Tuesday morning. The prime minister embarked on a frenzied round of visits to polling stations, then ordered an emergency meeting of top staff.
"It was very tense," said a party member with knowledge of the gathering. "They finally realised it could all unravel."
It held together, in the end, but the "victory" celebration at Likud's cavernous Tel Aviv campaign headquarters was a sombre affair. Only a few hundred loyalists turned up, with loud bickering flaring over who or what to blame for the setback.
STROKE OF GENIUS?
Some openly questioned the wisdom of the union with Yisrael Beitenu, whose brash Soviet-born leader, former Foreign Minister Avigdor Lieberman, alienated some Likud rank-and-file.
Likud stalwart Tzachi Hanegbi defended the alliance as "a genius thing to do, even though we lost some members" because it guaranteed Netanyahu the premiership by co-opting a major rival.
But Hanegbi told Reuters their apparent pre-election confidence appeared to have persuaded some Likud voters that they could safely shift support to Yesh Atid without jeopardising Netanyahu's chances of remaining prime minister.
Describing Lapid as "secular, new, fresh," Hanegbi conceded: "It is now going to be more difficult for us to establish a government."
Doron Attias, a Likud Central Committee member, said the party had also lost votes rightward - to another political upstart, Naftali Bennett of the pro-settler, religious-nationalist Jewish Home, which came fourth in the ballot.
"I'm angry and I'm hurt," Attias said, accusing settlers of betraying Netanyahu, who has expanded Jewish settlements across the occupied West Bank and east Jerusalem - land the Palestinians demand for a future independent state.
"I think we should stop investing in Judea and Samaria," Attias said, using the Biblical term for the West Bank.
Yet Netanyahu might himself have contributed to the Likud defections by accusing Bennett, an elite army commander, of encouraging insubordination after he voiced reluctance to take part in any future evacuations of West Bank settlements.
Likud campaigners also denounced the more radical views of some on the Jewish Home list - attacks that allowed Bennett to portray himself as victim of an electoral mugging.
"The attack pushed religious voters from the Likud to Bennett, and it pushed young right- wing, but non-religious voters, away from Bennett into Lapids arms," wrote Nahum Barnea in the biggest-selling Israeli newspaper Yedioth Ahronoth.
Few Likud supporters criticised Netanyahu openly in the wake of their dismal showing - a reflection of the party's tradition of rallying together, but also of the reality that the prime minister has no credible rival for the party leadership.
"Likudniks don't trash other Likudniks in public," Likud Central Committee member Dudu Hayyim warned fellow activists at the election headquarters as journalists hovered for quotes.