TEL AVIV — At his victory celebration early Wednesday, supporters of Prime Minister Benjamin Netanyahu began to chant, ‘‘You are the magician!’’
After a resounding clutch-time comeback in Israel’s parliamentary elections, Netanyahu is poised to serve a record fourth term as prime minister. If he makes it through the full four-year term, his time in office could exceed that of Israel’s longest-serving leader, the country’s founder, David Ben-Gurion.
Netanyahu will form his next government after a bruising campaign that exposed him to charges of racism and hysteria, for his complaint that droves of Arab Israeli citizens were voting and his warning that his opponents would welcome the militant Islamist group Hamas to the edges of Jerusalem.
On Wednesday, Netanyahu and his Likud party began negotiating a new coalition government, which will probably be buttressed by nationalists, religious Zionists, populist former Likudniks, the pro-settlement camp, and two religious parties that represent ultra-Orthodox Jews and are overseen by powerful rabbis.
But the next Netanyahu government will face a host of challenges at home, on its borders, and abroad.
On Monday, in the heat of the campaign, Netanyahu made the sensational promise that he would not support the creation of a Palestinian state as long as he was prime minister, a stunning reversal of his earlier stance supporting a two-state solution to the Israel-Palestinian conflict.
His announcement convinced many Netanyahu skeptics that this has been the prime minister’s true position all along and that he has wasted American time and patience by pretending to endorse two states. The creation of a Palestinian state was the focus of nine months of negotiations last year led by US Secretary of State John Kerry.
In Europe, leaders frustrated by more than four decades of military occupation in the West Bank and the repeated failures of peace talks have begun to openly debate employing sanctions against Israel to push for a sovereign Palestinian state, which Netanyahu now vows he would never allow.
More trouble — in the guise of resolutions and condemnations of Israel’s human rights record — could await Netanyahu in the international community. The United Nations said Wednesday that it expects Israel to continue with the Middle East peace process to negotiate a Palestinian state.
Reacting to Netanyahu’s win, the Palestinian leadership in Ramallah promised Wednesday to go to the International Criminal Court at The Hague on April 1 to press war crimes charges against Israeli soldiers and leaders, focusing on the civilian deaths during the 50-day war in Gaza during the summer and the continued construction of Jewish settlements in the Israeli-occupied West Bank.
For his part, Netanyahu has said in the past that it is war crimes and terror attacks by Hamas that the United Nations should be condemning.
The election was closely watched in Washington, where relations are strained between Netanyahu and the White House after the prime minister gave a speech to Congress two weeks ago opposing the Obama administration’s possible deal with Iran to rein in Tehran’s nuclear program.
Netanyahu, who has made the fight against a nuclear Iran the centerpiece of his foreign policy, will probably side with congressional Republicans again and clash with President Obama if Kerry secures what the prime minister considers ‘‘a bad deal.’’
In Lausanne, Switzerland, where Iran and the United States are holding nuclear talks, Iran’s foreign minister, Mohammad Javad Zarif, described Netanyahu’s victory as a step backward for Israel and the region.
Netanyahu will probably not care what the Iranians say. He has called Iran’s leaders ‘‘wolves in sheep’s clothing’’ and said they answer not to their citizens but to Holocaust-denying ayatollahs committed to Israel’s annihilation.
Kerry called Netanyahu on Wednesday morning to congratulate him. Israeli news media spent the day speculating on when Obama would phone. Prime Ministers Stephen Harper of Canada and David Cameron of Britain placed calls to Netanyahu on Wednesday.
Netanyahu and Likud took 30 seats in the 120-seat Parliament, against the 24 forecast for the center-left Zionist Union alliance of Labor Party leader Isaac Herzog and his running mate, former peace negotiator Tzipi Livni.
Netanyahu’s victory represents a crushing defeat for his challengers, who believed themselves so close to a win, based on opinion surveys.
Herzog conceded the election in a telephone call to Netanyahu on Wednesday morning and later said that he would most likely focus on leading the opposition in Parliament.
‘‘I wished him luck, but let it be clear: The problems are the same problems, nothing has changed,’’ Herzog told reporters.
Herzog will be joined in the opposition by politicians from the Joint List of Arab parties, which won 14 seats, making it the third-largest vote-getter. Arabs represent about 20 percent of Israel’s population.
As polls ahead of the vote showed Likud trailing the Zionist Union, the prime minister warned that he and his party were ‘‘in real danger,’’ that the left was about to win and to give away ‘‘land for peace’’ and ‘‘divide’’ Jerusalem; that unnamed ‘‘foreign powers’’ were pouring millions of dollars into a campaign against him; that Arab Israeli citizens were going to the polls ‘‘in droves,’’ bused by nongovernmental organizations dedicated to his downfall.
Netanyahu also promised that there would be ‘‘no concessions’’ to the Palestinians and ‘‘no withdrawals’’ from the West Bank during his watch. He appeared Monday at the Jewish settlement of Har Homa in East Jerusalem to highlight his commitment to continued construction. Europe and the United Nations say that the settlements in Israeli-occupied West Bank and East Jerusalem are illegal under international law. Israel disputes this.
Rabbi Rick Jacobs, president of the Union for Reform Judaism in the United States and a major leader of American Jewry, condemned Netanyahu’s last-ditch tactics as ‘‘a naked appeal to his hard-right bases’ fears rather than their hopes.’’
Whatever one calls it, it appears to have worked. Avi Degani, a leading Israeli pollster and president of the Geocartography Knowledge Group, said Wednesday that the last opinion polls showing a possible Likud loss not only motivated Netanyahu but also caused panic among reluctant voters on the right, pushing them to vote for Likud at the last minute out of fear that the left wing would take over.
Gil Hoffman, a columnist for the Jerusalem Post, said Netanyahu mobilized voters from what he called ‘‘the second Israel,’’ who came out to protect Israel from the left, from Iran and what they perceive as a hostile international community.
In an editorial titled ‘‘King Bibi and his divided people,’’ David Horovitz, the founding editor of the Times of Israel news website, called Netanyahu ‘‘a political tactician in a different league from his rivals.’’
‘‘But amid the euphoria of victory, and the majority’s reaffirmation of faith in his leadership, will he take heed of the fact that a substantial proportion of the electorate is as shocked and horrified by Tuesday’s results as he and his supporters are shocked and delighted?’’ Horovitz asked.