Prime Minister Benjamin Netanyahu’'s Likud party was the clear winner in Tuesday’s election, a near-final tally showed early Wednesday morning, defeating the Zionist Union by a margin of some six seats.

That margin was far more decisive than TV exit polls had predicted when polling booths closed at 10 p.m. on Tuesday. All three TV polls had put Likud and Zionist Union neck-and-neck at 27 seats, albeit with Netanyahu better-placed to form a coalition.

On the basis of those TV polls, Netanyahu hailed a Likud victory, though Herzog refused to concede. As counting proceeded through the night, however, the Likud opened a growing margin of victory.

By 5 a.m., with some 90% of votes counted, the Central Elections Committee was indicating a dramatic victory for Netanyahu, with the Likud heading for 29 seats, compared to Zionist Union’s 24 seats.

Next came the Joint (Arab) List on 14 seats, Yesh Atid on 11, Kulanu on 10 and the Jewish Home on 8. They were followed by Shas, 7, United Torah Judaism on 6, Yisrael Beytenu on 6, and Meretz on 5 seats.

Four hours earlier, at 1 a.m., Netanyahu claimed a victory “against all odds” and promised to form a new government without delay. But Herzog also said he would make “every effort” to build a coalition. Either will likely need the support of Moshe Kahlon of the Kulanu party, whose campaign focused almost entirely on bread-and-butter economic issues, refused to take sides, but he is a former Likud minister.

As the exit poll results were announced on the nation’s three major TV stations, celebrations erupted at Likud’s campaign headquarters in Tel Aviv. “Against all odds we obtained a great victory for the Likud,” Netanyahu told the gathering. “Now we must form a strong and stable government that will ensure Israel’s security and welfare,” he added, in comments aimed at Kahlon.

He said he had already been in touch with all other “nationalist parties” in hopes of quickly forming a coalition — apparently ruling out a partnership with Herzog.

Netanyahu focused his campaign on security issues, while his opponents instead pledged to address the country’s high cost of living and accused the prime minister of being out of touch with everyday people. Herzog also promised to repair tattered ties with the US and to revive peace efforts with the Palestinians.

Herzog said he too had reached out to potential coalition partners. In a nod to Kahlon, he said he was committed to forming a “real social reconciliation government” committed to lowering the cost of living and reducing gaps between rich and poor.

Netanyahu’'s return to power would likely spell trouble for Mideast peace efforts and could further escalate tensions with the United States.

Netanyahu, who already has a testy relationship with US President Barack Obama, took a sharp turn to the right in the final days of the campaign, staking out a series of hard-line positions that will put him at odds with the international community.

In a dramatic policy reversal, he said he now opposes the creation of a Palestinian state — a key policy goal of the White House and the international community. He also promised to expand construction in Jewish areas of East Jerusalem, the section of the city claimed by the Palestinians as their capital.

Netanyahu infuriated the White House early this month when he delivered a speech to the US Congress criticizing an emerging nuclear deal with Iran. The speech was arranged with Republican leaders and not coordinated with the White House ahead of time.

In Washington, White House spokesman Josh Earnest said Obama was confident strong US-Israeli ties would endure far beyond the election regardless of the victor.

The process of building a government, nonetheless, will depend on the final results, as well as on whom the various party leaders recommend that President Reuven Rivlin entrust with the opportunity to form a coalition.

Vote counting was continuing through the night, with more conclusive figures expected in the coming hours. The Central Elections Committee published real-time counting results on its website (Hebrew).

The exit polls, conducted by Israel’s three main television stations, showed Likud at 27-28 seats and Zionist Union at 27.

Netanyahu called the result a “great victory for the Likud. A major victory for the people of Israel.”

In the TV polls, potential Likud ally Naftali Bennett’s right-wing Jewish Home was heading for eight-nine seats, and Avigdor Liberman’s nationalist Yisrael Beytenu was set for five seats. Together with the two ultra-Orthodox parties — Shas, which was expected to win seven seats, and the United Torah Judaism, which was heading for six-seven seats — this could give Netanyahu the firm basis for a right-wing/Orthodox coalition. If Netanyahu can bring in Kulanu, that mix would give him a narrow majority in the 120-seat Knesset.

On the other side of the aisle, Herzog’'s natural ally, the left-wing Meretz party, was headed for five seats, while the centrist Yesh Atid was set to win 11-12 seats. Even with support inside or outside a coalition from the Arab Joint List, which looked set to score an impressive 12-13 seats, that would leave Herzog far short of a majority. Kahlon’s support, were it forthcoming, could conceivably give Herzog a blocking majority, but this scenario seemed highly implausible.

The election was initiated more than two years ahead of schedule by Netanyahu, who fired his finance minister Yair Lapid and justice minister Tzipi Livni in early December.

The campaign was largely seen as a referendum on the Likud leader, who is Israel’s second-longest-serving prime minister, having held the job since 2009 after a previous term in 1996-9.

On election day itself, Netanyahu repeatedly protested what he said was foreign funding that was helping to get out the Arab vote, and potentially skewing the elections. “There is nothing illegitimate with citizens voting, Jewish or Arab, as they see fit,” he said on Tuesday afternoon. “What is not legitimate is the funding —- the fact that money comes from abroad from NGOs and foreign governments, brings them en masse to the ballot box in an organized fashion, in favor of the left, gives undue power to the extremist Arab list, and weakens the right bloc in such a way that we will be unable to build a government — despite the fact that most citizens of Israel support the national camp and support me as the prime minister from Likud.”

He also castigated the leader of the Joint List: “"Ayman Odeh, who supports Herzog, has already said not only that I must be replaced, but that I should be put in prison for defending the citizens of Israel and the lives of IDF soldiers [during last summer’s Gaza war]…. A left government that depends on such a list will surrender at every step, on Jerusalem, the 1967 lines, on everything,”" Netanyahu railed, “and therefore there'’s an immense effort of leftist NGOs to mobilize voters from the left bloc, primarily in the Arab sector, and in areas where leftists vote.”

Netanyahu’'s increasingly hawkish statements underpinned his successful effort to dissuade right-wing Israelis from voting for parties other than Likud, gathering steam as opinion polls in the run-up to Tuesday’s vote showed Herzog gradually opening a three-to-four seat lead.

The Zionist Union leader, son of the late Israeli president Chaim Herzog and the grandson of Israel’s first chief rabbi, fought a fairly effective campaign, partnering his Labor party with Livni'’s Hatnua and focusing on the socioeconomic issues that are high on many Israelis’ lists of prime concerns. He blamed Netanyahu for soaring house prices and for the relatively high overall cost of living and branded Netanyahu as out of touch with the day-to-day concerns of ordinary Israelis.

Herzog, like the prime minister, stressed the imperative of preventing Iran from attaining nuclear weapons, though he argued against Netanyahu'’s speech to Congress. And he took a wary stance on the Palestinian issue —- firmly backing a two-state solution and declaring a readiness to evacuate isolated West Bank settlements, but also vowing to keep Jerusalem united and to seek sovereignty over major settlement blocs. In this respect, he reflected the stances of some of Labor’'s more hawkish past leaders, such as the assassinated prime minister Yitzhak Rabin, in a bid to avoid alienating potential voters from the center of the spectrum.