President Trump appeared to distance himself from embattled Israeli Prime Minister Benjamin Netanyahu on Wednesday, declining to offer either encouragement or praise to his most enthusiastically loyal foreign ally now that he faces potential electoral defeat.

Speaking a day after Israeli elections that at best leave Netanyahu weakened, Trump seemed cool to the Israeli conservative who has touted his ideological lockstep with Trump as a chief reelection credential.

Trump said he had not spoken to Netanyahu, a man he has described as a close friend. He then noted that the election is close while playing down Netanyahu’s importance to the alliance between the United States and Israel.

“Our relations are with Israel, so we’ll see what happens,” Trump told reporters traveling with him in California.

Netanyahu failed to win a clear majority in national elections Tuesday that the long-serving conservative leader had hoped would give him a strong mandate for another term and armor against a looming corruption case.

During his presidency, Trump has tightly embraced Netanyahu and his hawkish views on the Israeli-Palestinian conflict, frequently winning praise from the prime minister for such things as moving the U.S. Embassy to Jerusalem and announcing that the United States would recognize Israeli sovereignty over the Golan Heights. But his comments Wednesday underscored Trump’s penchant for separating himself from political allies once they become weakened or could serve as a liability to him.

“Ice cold,” Brookings Institution Middle East specialist Tamara Cofman Wittes observed on Twitter.

Now Trump will have to decide how to deal with a weakened Netanyahu or a new prime minister whose views may be more dovish than Trump’s on the Middle East.

The calculation for Trump — who has said that American Jews who vote for Democrats are being “disloyal” to Israel — will be as much about domestic politics ahead of the 2020 election as it is about foreign policy. The president’s hard-line approach has served not only as an attempt to win over some Jewish voters who have previously supported Democrats but to appeal to evangelicals, who are among his staunchest supporters and revere Israel for its role in the biblical story.

Netanyahu may be able to survive if he can cobble together a coalition or power-sharing government, and numerous analysts suggest he has a better chance to do so than his chief challenger, former Army officer Benny Gantz. Any such arrangement would leave Netanyahu with less autonomy.

Trump’s comments Wednesday showed that he smelled weakness and wanted to give himself some insulation from Netanyahu, said Dan Shapiro, a former U.S. ambassador to Israel.

Trump, Shapiro said, wants little to do with a “loser.”

Last week, Trump declined to publicly endorse Netanyahu’s pledge to annex parts of the West Bank if he were reelected.

That stood in contrast to the warm words surrounding Netanyahu’s election bid five months ago, when Trump announced the United States’s new policy stance on the Golan Heights and seemed happy to have Netanyahu make a show of their close relationship.

In a small gesture, Trump did announce last weekend that he and Netanyahu would explore a mutual defense treaty. Such a pact would change little about the two nations’ military relationship, and Trump said only that the idea was under review.

Aaron David Miller, a former U.S. adviser on Israeli and Palestinian issues, said Trump began to sour on Netanyahu because of his struggles in Israel’s April election. For Trump, keeping up his pro-Israel credentials and pleasing conservative Jewish and evangelical voters is more important than the bond he forged with Netanyahu, Miller said.

“Trump only cares about one election, and it’s not Benjamin Netanyahu’s,” Miller said.

Trump had bet on Netanyahu as a canny politician and fellow tough guy, remarking to friends that Netanyahu was a “survivor” who beat the odds, people who have spoken with Trump about Israeli politics said, discussing the private conversations under the condition of anonymity.

But Trump never saw Netanyahu as the only key to his own political fortunes with Jewish voters or conservatives for whom Iran’s ability to threaten Israel is a primary concern, these people said.

Rather, Trump saw Netanyahu as a partner in building a consensus against the legacy of former president Barack Obama, who had a troubled relationship with Netanyahu and broke with him over pursuit of an international agreement limiting Iran’s nuclear ambitions. Both Netanyahu and Trump argue that the 2015 deal was full of holes.

The two bonded over Trump’s adoption of Netanyahu-like rhetoric about the nuclear deal, which was inked just as Trump’s outsider candidacy was taking off.

Trump has run down a checklist of pro-Israel actions as president, most coordinated with Netanyahu. He inveighed against the nuclear deal and walked out of it last year. He upended decades of U.S. policy by recognizing Jerusalem as the Israeli capital. He inaugurated an effort to broker peace between Israel and the Palestinians that did not set a sovereign Palestine as the end goal, and he installed an ambassador who had rhetorically and financially supported West Bank settlements.

Netanyahu tried to leverage all of that, with Trump’s blessing. But that did not mean Trump viewed the entire relationship with Israel as hinged to Netanyahu, a senior administration official said.

“The president is right” to say that the U.S. relationship is with Israel, not its leader, the official said. “Our relationship is bigger than individuals. We had the worst possible relationship between Obama and Netanyahu, and that did not mean the relationship itself was at risk,” said the official, who like others spoke on the condition of anonymity because they were not authorized to discuss the matter on the record.

Trump has chafed at Netanyahu’s opposition to potential new diplomacy with Iran, a project Trump sees as a chance to build his legacy as a peacemaker, current and former administration officials said.

Shared opposition to the nuclear deal with Iran helped cement Trump’s close relationship with Netanyahu, but Trump’s objection to the agreement was tied to his belief that he could get a better bargain. Netanyahu opposes anything that Iran could spin as a concession, including overtures from the American president.

Trump loyalists were annoyed by Netanyahu’s hasty trip earlier this month to London, where he met with Prime Minister Boris Johnson in what was widely seen as an attempt to pressure Trump away from direct engagement with Iran.

Trump rankled some American Jews with his remark last month that “if you vote for a Democrat you’re very, very disloyal to Israel and to the Jewish people.”

The remark and its echoes of anti-Semitic rhetoric about dual loyalty are unlikely to depress votes among Jewish Republicans, however, Trump advisers said.

Netanyahu’s office announced Wednesday that in light of the political disarray, he would not attend the annual United Nations General Assembly next week, an appearance he has regularly used to make the case for international unity against what he calls an existential threat from Iran.

“Given that Bibi didn’t do so well during the elections, he knows there is no way he could go and give a big speech at the U.N.,” an Israeli security official said. “He wouldn’t have the legitimacy to do so at the moment.”

But Netanyahu’s decision also forecloses a meeting with Trump, which both nations had said was likely if Netanyahu attended.

That may be a relief to Trump, who is already looking beyond Netanyahu to what a future Israeli government might mean for his hopes to launch an Arab-Israeli peace plan this year, two people familiar with the plan said.

A coalition government that clips Netanyahu’s wings might improve chances for that plan, which will ask concessions of Israel, one former senior administration official said.

A Israeli official summed it up this way: “Yes, he is friends with Bibi, but he also likes winners and he does want to move his peace plan forward no matter who the prime minister is.”

Steve Hendrix in Jerusalem and Souad Mekhennet in Washington contributed to this report.