Mr. Biden has spoken publicly about how he once sent Mr. Netanyahu a photograph with the inscription, “Bibi, I don’t agree with a damn thing you say, but I love you.”

WASHINGTON — President Biden has maintained his public support toward Israel even as he adopted a somewhat sharper private tone with Prime Minister Benjamin Netanyahu, a calculus shaped by Mr. Biden’s longtime relationship with the Israeli leader as well as by growing hopes that Israel’s military operations against Hamas are nearing an end.

In a phone call on Monday, Mr. Biden warned Mr. Netanyahu that he could fend off criticism of the Gaza strikes for only so long, according to two people familiar with the call. That conversation was said to be significantly stronger than an official summary released by the White House. It affirmed Israel’s right to self-defense and did not repeat calls by many congressional Democrats for an immediate cease-fire.

That phone call and others since the fighting started last week reflect Mr. Biden and Mr. Netanyahu’s complicated 40-year relationship. It began when Mr. Netanyahu was the deputy chief of mission at the Israeli Embassy in Washington and Mr. Biden was a young senator with a passion for foreign affairs. Since then, they have rarely seen eye to eye, but have forged an occasionally chummy working relationship through seven American presidencies — Mr. Netanyahu has been prime minister for four of them — and raging political battles over the Iran nuclear deal and Israeli settlement policy.

Today, that relationship is as complicated as ever. Mr. Biden’s juggling act on Israel, always a challenge for an American president, is especially difficult given that Democrats are no longer solidly in Israel’s corner.

Middle East experts and former United States officials say that many of Mr. Biden’s calculations are rooted in a different era of American-Israeli relations — when Israel’s security concerns commanded far more attention than Palestinian grievances — and that his approach has less to do with the military situation on the ground than with domestic politics and his broader foreign policy agenda, including nuclear talks with Iran.

For his part, Mr. Netanyahu is fighting for his political life at home while trying to sustain support for his country in Washington. With Mr. Biden now in the Oval Office, the men are again trying to sustain mutual trust amid larger forces driving them apart.

Martin S. Indyk, a former United States ambassador to Israel, said that Mr. Biden had bought himself private space to persuade Mr. Netanyahu to wind down the strikes in Gaza, which were launched in retaliation for Hamas’s indiscriminate rocket attacks on Israeli cities. Mr. Indyk also said that Mr. Biden was trying to get the Israeli leader to agree to a cease-fire “by making clear publicly that he was in Israel’s corner, that Israel has a right to defend itself, and that he has Netanyahu’s back.”

“That was very important for the moment that has now come, in which he has to turn to Netanyahu and say, ‘Time to wrap it up,’” Mr. Indyk said.

Mr. Biden and Mr. Netanyahu have been through countless highs and lows together.

After Mr. Netanyahu faced his first electoral defeat, in 1999, Mr. Biden sent him a letter, praising him for having shown political courage during talks with the Palestinians that were hosted by the United States in Maryland. Mr. Netanyahu replied, and gratefully noted that Mr. Biden was the only American politician to write to him after his defeat.

But in 2010, Mr. Biden, then the vice president, had just begun a visit to Israel when he was blindsided by the unwelcome news that Israel’s government was approving new housing construction in East Jerusalem, a setback to Obama administration efforts to mediate Israeli-Palestinian peace talks.

Obama White House officials were enraged, and several urged Mr. Biden to skip a planned dinner with Mr. Netanyahu in Tel Aviv and leave the country immediately. Mr. Biden disagreed, and chose to confront the Israeli leader in private while minimizing the public discord, betting that such an approach would be more effective, people familiar with the episode said.

Prime Minister Benjamin Netanyahu last week in Lod, Israel. He and Mr. Biden have had a complicated 40-year relationship.
Pool photo by Yuval Chen

“Progress occurs in the Middle East when everyone knows there is simply no space between the United States and Israel,” Mr. Biden said, standing beside Mr. Netanyahu at the prime minister’s residence. “There is no space between the United States and Israel when it comes to Israel’s security.”

Over dinner, his tone was markedly more critical.

In keeping with Mr. Biden’s longtime view that foreign policy is driven by personal relationships, he has repeatedly made clear over the years that his sometimes exasperation with Mr. Netanyahu’s right-wing policies in such moments never ruptured the men’s bond.

Mr. Biden has spoken publicly about how he once sent Mr. Netanyahu a photograph with the inscription, “Bibi, I don’t agree with a damn thing you say, but I love you.”

And after tensions between Mr. Netanyahu and the Obama White House over Iran’s nuclear program burst into public view in late 2014, Mr. Biden, during a speech to a Jewish American group, offered assurances that he and the Israeli leader were “still buddies.”

People familiar with Mr. Biden’s thinking say that his perspective on Israel is informed by much more than his relationship with Mr. Netanyahu. Mr. Biden often recalls a visit he paid as a 30-year-old senator in the fall of 1973 to Israel’s prime minister, Golda Meir, on the eve of an attack on Israel by a coalition of Arab states in what is known as the Yom Kippur War.

Saying he was shaken by the scale of the threat to Israel, Mr. Biden has called that “one of the most consequential meetings I’ve ever had in my life.”

In the years since, Mr. Biden has repeatedly underscored his devotion to the country. “I am a Zionist,” he told an Israeli television station in 2007. “You don’t have to a Jew to be a Zionist.”

Michael Oren, who served as Israel’s ambassador to Washington from 2009 to 2013, said that in an Obama administration where many senior officials mistrusted Mr. Netanyahu’s Likud government and shut out Mr. Oren, Mr. Biden served as his main interlocutor.

“He exhibited, I thought, great insight into the personality of Benjamin Netanyahu,” Mr. Oren said. He said Mr. Biden saw that tensions between President Barack Obama and Mr. Netanyahu made for “a very flammable environment that he did his best to ease down.”

Samar Abu Elouf for The New York Times

Mr. Oren added that Mr. Biden always threw “a great Rosh Hashana” party at his vice-presidential residence to celebrate the Jewish New Year.

Today, the president hopes that Mr. Netanyahu can help him avoid becoming mired in an Israeli-Palestinian conflict with dim prospects of resolution at a time when he has been focused on other foreign policy priorities, including climate change, countering China and restoring the 2015 Iran nuclear deal.

“I think the Biden administration was caught a bit off-guard here,” said Sanam Vakil, the deputy director of the Middle East and North Africa program at the London-based think tank Chatham House. “It has taken them a few days to mobilize and find their footing.”

On Tuesday, the White House press secretary, Jen Psaki, told reporters aboard Air Force One that Mr. Biden “has been doing this long enough to know that the best way to end an international conflict is typically not to debate it in public.”

“Sometimes diplomacy needs to happen behind the scenes — it needs to be quiet, and we don’t read out every component,” she said.

Avi Ohayon/Israeli Government, via Associated Press

The conflict has distracted Secretary of State Antony J. Blinken from a trip to the Arctic region intended to focus on one of Mr. Biden’s top priorities: climate change. Mr. Blinken spent most of his flight to Denmark on Sunday discussing the matter on the phone, a senior Biden administration official said, and continued to make calls to foreign leaders and fellow American officials during a stop on Tuesday in Iceland.

But the State Department has physically dispatched to the region only a midlevel official, the deputy assistant secretary of state for Israel and Palestinian affairs, Hady Amr.

Some former Obama administration officials recall as a cautionary tale Secretary of State John Kerry’s failure to secure a cease-fire in Israel’s 2014 Gaza conflict, which raged for two weeks after Mr. Kerry visited the region in a futile bid to stop the fighting.

In the short term, senior Biden administration officials hope an initial pause in the crossfire will allow for humanitarian aid to reach Palestinians who have fled or lost their homes and will serve as a step to a lasting cease-fire.

Emily Rose Bennett for The New York Times

But such hopes have been dashed before. After his first two conversations with Mr. Netanyahu last week, Mr. Biden expressed his “expectation and hope” that the conflict was nearing an end. More than 100 innocents have been killed in the fighting since then.

Asked why Mr. Biden has not publicly called for a cease-fire, as have dozens of congressional Democrats, a senior administration official said that doing so could be counterproductive and prolong the violence. Some analysts agree that such calls may inspire defiance among Mr. Netanyahu, his political allies and the Israeli public.

Mr. Oren said that he believed that Mr. Biden’s publicly supportive posture toward Israel, which has drawn an increasing number of complaints from congressional Democrats, is motivated in part by indirect negotiations with Iran this month in Vienna that are aimed at restoring the nuclear deal with Tehran, another of Mr. Biden’s top priorities.

“I wouldn’t be surprised if, in the aftermath of this conflict, the Biden administration would say to the Israeli government: ‘You see how we supported your right to defend yourself against Hamas? Trust us to ensure your defense as we renew the Iran nuclear deal,’” Mr. Oren said.

It is not clear whether that is a message that Mr. Biden would deliver to Mr. Netanyahu himself, however. The Israeli leader faces criminal charges, and he has struggled to form a governing coalition that would prevent him from the likelihood of losing power for the first time since 2009.

Lara Jakes contributed reporting.