Two weeks ago, Prime Minister Rishi Sunak of Britain was facing a chorus of calls to cut off arms shipments to Israel because of its devastating war in Gaza. On Monday, Mr. Sunak saluted the British warplanes that had shot down several Iranian drones as part of a successful campaign to thwart Iran’s attack on Israel.

It was a telling example of how the clash between Israel and Iran has scrambled the equation in the Middle East. Faced with a barrage of Iranian missiles, Britain, the United States, France and others rushed to Israel’s aid. They set aside their anger over Gaza to defend it from a country they view as an archnemesis, even as they pleaded for restraint in Israel’s response to the Iranian assault.

Prime Minister Benjamin Netanyahu, whose approval of a deadly airstrike on a meeting of Iranian generals in Damascus on April 1 provoked Iran’s retaliation, has managed to change the narrative, according to British and American diplomats and analysts. But it could prove to be a fleeting change, they said, if Mr. Netanyahu orders a counterstrike damaging enough to pitch the region into wider war.

“We would urge them to take the win at this point,” Mr. Sunak said in Parliament, borrowing a phrase that President Biden used in a phone call with Mr. Netanyahu on Sunday after Iran’s attack had been mostly repelled.

Mr. Sunak was expected to have his own call with Mr. Netanyahu on Tuesday, part of a full-court press by European leaders to urge him not to allow the clash with Iran to spiral uncontrollably. President Emmanuel Macron of France, which played a supporting role in the military operation, told a French news channel, “We will do everything to avoid a conflagration — that is to say, an escalation.”