The statement reversed Mr. Netanyahu’s endorsement of a two-state solution to the Israeli-Palestinian conflict in a 2009 speech at Bar Ilan University, and fulfilled many world leaders’ suspicions that he was never really serious about peace negotiations. If he manages to eke out a fourth term, the new stance would further fray Mr. Netanyahu’s ruinous relationship with the Obama administration and heighten tension with European countries already frustrated with the stalled peace process.

“I think that anyone who is going to establish a Palestinian state today and evacuate lands is giving attack grounds to the radical Islam against the state of Israel,” he said in a video interview published on NRG, an Israeli news site that leans to the right. “There is a real threat here that a left-wing government will join the international community and follow its orders.”

Mr. Netanyahu’s chief challenger, Isaac Herzog of the center-left Zionist Union, backs the two-state solution and has promised to try to restart talks with the Palestinians, though he has warned an agreement may not be possible. He has, however, made Mr. Netanyahu’s alienation of allies, especially Washington, a prime campaign point, and said Israel’s international isolation is itself a security threat.

Supporters of Prime Minister Benjamin Netanyahu of Israel at a campaign rally in Tel Aviv. Voters go to the polls on Tuesday.

Jack Guez / Agence France-Presse — Getty Images

With his conservative Likud Party trailing the Zionist Union in the last pre-election polls, Mr. Netanyahu has ratcheted up his statements in a panicky blitz of interviews and campaign stops in recent days. He accuses rivals of colluding with Arabs and moneyed antagonists in a global conspiracy to oust him. He has also belatedly begun to address the pocketbook questions that polls suggest will drive most people’s votes.

But in many corners, these efforts and the Palestinian flip-flop only underscore a longstanding critique: that Mr. Netanyahu, 65, who led Israel for three years in the 1990s and returned to the premiership in 2009, places staying in power above all else.

He himself called these early elections three months ago, confidently aiming to replace a governing coalition fractured over the Palestinian conflict and matters of religion with one he could more easily control. Instead, as Israelis head to the polls Tuesday, Mr. Netanyahu is struggling for political survival in a nation itself riven over those issues and consumed with the high cost of housing and groceries.

Suddenly, the man crowned “King Bibi” — whose hard-line stance against the Iranian nuclear program and continued construction in West Bank settlements hurt him in some foreign capitals but resonated in an increasingly fearful and religious Israel — is being asked whether he would retire if he were not re-elected.

Isaac Herzog, third from right, of the center-left Zionist Union, posed with supporters Monday at party headquarters in Tel Aviv.

Nir Elias / Reuters

The election has become a referendum on Mr. Netanyahu’s rule. While Israel’s complicated electoral math gives him a good chance of remaining at the helm even if the Zionist Union wins more of Parliament’s 120 seats than the Likud, the campaign has revealed a yearning for change across the spectrum.

“A lot of people on the right wing are still right wing, they are just tired of him specifically, it’s very, very personal,” said Tal Schneider, a political blogger. “Israelis, they perceive themselves as creative, as nonconformists, they hate the feeling of stagnation, of seeing themselves as counting down to another war. This vacuum, this feeling of forever status quo, this is the Bibi fatigue.”

Mr. Herzog, the son of a storied Israeli dynasty whose father, Chaim, was Israel’s sixth president, prayed Monday at the Western Wall in Jerusalem’s Old City and vowed to unify the nation “after a long period of division.”

“I promise: I will be a prime minister to everyone,” said Mr. Herzog, 54. “For right and left, for settlers, Haredim, Druze, Arabs, Circassians; I will be prime minister for the center and for the periphery.”

Later, he announced that his partner in Zionist Union, Tzipi Livni, had agreed to drop their deal to rotate the premiership — a focus of Mr. Netanyahu’s case against them. Ms. Livni’s lower popularity had made the deal an electoral liability and would also complicate coalition brokering.

“We are united in our task to change the government,” Mr. Herzog said on Israeli television Monday evening. “The choice tomorrow is between desperation and hope, and the hope of the greater good for this country is change of the government.”

It was the formation of the alliance that altered the arc of the campaign. Polls quickly proved it more than the sum of its parts — Mr. Herzog’s midsize Labor Party and Ms. Livni’s tiny Hatnua — and put it on par with Likud in terms of Parliament seats.

But the right-wing bloc still looked far larger than the center-left, making Mr. Herzog’s path to the premiership difficult to plot. Seen more as consensus builder than commander in chief, he took voice lessons to address a persistent squeak and asked people not to use his nickname, Bougie. The gap between him and Mr. Netanyahu on whom Israelis saw as most suitable to lead them shrank but remained significant.

Mr. Netanyahu’s emphasis on security, his strong suit, backfired somewhat with the sharp Democratic criticism of his speech to Congress this month opposing the emerging nuclear deal between six world powers and Iran. He got the standing ovations he expected, but also provided an opening for attacks on his preferred playing field.

Mr. Herzog and others argued that he was actually threatening Israel’s security by angering the White House, and that all his strident speeches had not yielded results on improving the terms of the Iran negotiations.

The Zionist Union, meanwhile, hammered Mr. Netanyahu on domestic issues, especially housing, helped by a harsh state comptroller’s report showing prices shot up 55 percent from 2008 to 2013 and had continued to climb since. (A previous comptroller’s report on spending at the prime minister’s residences, including a $40,000 take-out tab one year, hardly helped the Netanyahu fatigue.)

The economic platform was also seized by Yesh Atid, the centrist faction that had stunned Israel by winning 19 Parliament seats in the last election, 2013, and Kulanu, a new party led by a popular former minister who broke from the Likud and had few nice things to say about his former boss.

“What’s striking is that the Israeli public seems to have lost interest with the Palestinian question — the general feeling is that it’s like the weather, nothing you can do about it,” observed Guy Ben-Porat, a political scientist at Ben Gurion University. “Economy, housing, all these issues where nobody’s sure what the difference is, exactly, between the parties, there’s a feeling of government failure. I think it’s really a personal election, meaning anti-Netanyahu.”

Most analysts agreed that Tuesday was unlikely to produce a clear winner. Once the votes are counted, Israel’s president, Reuven Rivlin, will poll party heads to see who they prefer as prime minister, a process that could take 10 days. Whoever Mr. Rivlin designates then has six weeks to try to create a coalition and form a government. Given the divisions, another possibility is a unity government, with the Zionist Union and Likud rotating the premiership — something both sides publicly oppose. Leaders of smaller parties said Monday night that Ms. Livni’s withdrawing her rotation agreement suggested that secret negotiations for shared power between Mr. Herzog and Mr. Netanyahu were already underway.

Tamar Hermann of the Israel Democracy Institute said the campaign has been “a struggle over the identity of the nation,” where she sees “overlapping cleavages” in income, education, religion and worldview.

“I’m very much afraid of the morning after,” Ms. Hermann said. “I see no way of either a right-wing government or a left-wing government acquiring the necessary public legitimacy, grass-roots legitimacy, in order to design — and more than that, implement — grand strategies on social-economic issues or even security-diplomatic matters.”

Voters appear energized by the close contest, and the last polls, published on Friday, suggest a large chunk remain undecided. Sara Dahan, a Jerusalem mother of three, said Sunday that she would either vote for the new Likud-breakaway, Kulanu, or, “if there is a chance my vote may influence helping making a change,” the Zionist Union.

“I don’t claim to know what is best for the country, but I do know what I see now and what I feel are the biggest problems,” said Ms. Dahan, who never before voted for Labor. “On the one hand is the security situation, which I would love to have some kind of solution for. On the other hand,” she added, “it’s the difficulties of a young couple, both working, having a difficult time buying an apartment, groceries, making it through the month.”

Mr. Netanyahu’s final push to win back voters from the right seemed to have worked on Adi Perkin, 24, who in 2013 backed the pro-settler Jewish Home, but said Sunday that “probably in the end I will vote for Bibi in order to strengthen him.”

“This election had a very bad side, which was that instead of talking to the citizens, the campaigns were about besmirching the others,” Ms. Perkin said. “All the ads were ‘just not Bibi,’ ‘just not Herzog.’ Instead they should have explained to the voters what they plan and what they want.”

But Ido Nitai, 21, a bar manager, voted for Mr. Netanyahu last time, and now is shopping for someone — anyone — else.

“If I wanted to keep the country in the same situation it is in today then I would vote for Bibi,” he said, “but I want to see a change here.”