TEL AVIV—Two significant constraints on Israeli Prime Minister Benjamin Netanyahu ’s ability to shape security policy are now gone.

He fired his defense minister , Yoav Gallant, his fiercest opponent within his own government, and Donald Trump won the U.S. election. Trump was widely believed to be less critical of Netanyahu’s policies than his opponent, Vice President Kamala Harris .

Both domestically and internationally, Netanyahu now has more room to maneuver.

Gallant, reflecting the view of Israel’s military, had been pushing publicly for the prime minister to accept a cease-fire in exchange for a hostage release deal, bring in Palestinian leadership that could replace Hamas in Gaza and begin discussions over a cease-fire in Lebanon.

Netanyahu, who calls for “total victory” in the war, has said that Israel can’t stop fighting in Gaza until Hamas is destroyed. He has rejected pressure domestically and from the U.S. to accept a cease-fire deal that would bring the war to an end.

Harris was widely expected to continue the Biden administration’s policies toward Israel, which included applying pressure to provide more humanitarian aid to Gazans or face threats of being cut off from U.S. shipments of much-needed weapons to Israel. The Biden administration has supplied Israel with weapons throughout the war but has at times slowed their shipment . The U.S. is also pushing for a cease-fire deal in Gaza and Lebanon.

Netanyahu called Trump’s potential win “historic” and said it “offers a new beginning for America and a powerful recommitment to the great alliance between Israel and America. This is a huge victory!” Netanyahu said Wednesday.

Former Israeli Defense Minister Yoav Gallant salutes as a sign of respect to Israel’s security forces at the end of a press conference and after he was sacked by Israeli Prime Minister Benjamin Netanyahu who cited a lack of trust, at the Ministry of Defense in Tel Aviv, Israel November 5, 2024. REUTERS/Nir Elias

In addition to allowing Israel to prosecute its wars more freely, Trump is unlikely to continue the Biden administration’s policy of sanctioning violent Israeli settlers in the West Bank. The leader of one of the largest settler umbrella organizations said a Trump win takes “the threat of a Palestinian state off the table.” Polls in Israel showed that a broad majority of Israelis had favored Trump over Harris.

“He thinks that he will be less constrained by Trump,” said Gideon Rahat, senior fellow at the Israel Democracy Institute. “This is an important milestone for him,” as Netanyahu believes his position has strengthened vis-à-vis the world and that this will give him more control in running the war, Rahat said.

Some analysts say Trump’s policy positions on Israel are still murky. He has said that he doesn’t want a regional war and thinks Israel should wrap up its fight in Gaza before he assumes office. With Trump only set to take his position in January, it also remains unclear if U.S. policy toward Israel would change in the next few months.

Netanyahu fired Gallant on Tuesday night following months of disagreement and what he said was a breakdown of trust between the two men who are barely on speaking terms, according to people familiar with the matter. Thousands of Israelis took to the streets of Tel Aviv and other Israeli cities to protest Gallant’s ouster late into the night.

Haredi men protest against mandatory military service in Ramat Gan, Israel. Photo: Amit Elkayam for WSJ.

A number of petitions were submitted on Wednesday to the Israeli High Court of Justice, challenging Gallant’s dismissal on the grounds that the prime minister’s decision was extremely unreasonable, a legal cause of action in Israeli administrative law for overturning a government decision.

The decision to fire Gallant also reflected a deep divide between the prime minister and Israel’s security establishment, which worries about the military being stretched on multiple fronts. Gallant was the chief proponent of the military’s viewpoint within the government. Without him, Netanyahu can have near total control over the war policy. Gallant’s replacement, the current foreign minister, Israel Katz , is viewed as a close Netanyahu ally who wouldn’t take an independent stance on the war aims.

The Biden administration and its European allies considered Gallant a trusted counterpart amid the White House’s growing frustration at Netanyahu over attempts to reach a cease-fire in Gaza and an expanding war in the Middle East with no clear end in sight.

But with Donald Trump ’s victory in the U.S. election, Netanyahu is likely to face less blowback for the move and to gain an administration in the White House that is less critical of his conduct. Analysts say that Netanyahu was hoping for a Trump victory, in part because has long identified with and shared Republican views.

Israeli left-wing activists hold signs during a protest against Israel’s actions in the Gaza Strip, amid the ongoing Israel-Hamas conflict, in Tel Aviv, Israel, October 27, 2024. REUTERS/Violeta Santos Moura

Israelis demonstrate after Israeli Prime Minister Benjamin Netanyahu sacked his defense minister, Yoav Gallant, citing lack of trust, in Tel Aviv, Israel November 5, 2024. REUTERS/Thomas Peter

A U.S. official called the decision to fire the defense minister concerning. “We have real questions about the reasons for Gallant’s firing and about what is driving the decision,” the official said. Gallant was the most vocal advocate of a cease-fire deal in Gaza and often served as a counterweight to a harder line pushed by Netanyahu in negotiations, humanitarian aid, and the day after in Gaza. Over the course of the war, Gallant spoke more than 80 times with U.S. Defense Secretary Lloyd Austin .

A key driver for the ousting was domestic politics, specifically Netanyahu’s need to pass a bill to exempt ultraorthodox men from military service, something that Gallant opposed due to manpower issues in the Israeli military. A small pool of reservists shoulder the burden and keep getting called back to serve for months on end. Netanyahu depends on the support of ultraorthodox parties to maintain his ruling coalition.

The issue is coming to a head with Netanyahu’s need for ultraorthodox votes to clear Israel’s 2025 budget, which by law must pass in the coming months, or Netanyahu could face snap elections.

In a press conference after his ouster, Gallant said he believed he was fired for his opposition to a law to exempt ultraorthodox from military service.

“Right now the musical chairs in the government are to solidify his coalition, and get a softened version of the bill of the draft law for the ultraorthodox,” said Reuven Hazan, a political scientist at the Hebrew University of Jerusalem.

The draft bill, however, remains broadly unpopular with the Israeli public.

“He removed an obstacle but he may have created a major obstacle for himself domestically,” said Alon Pinkas, a former Israeli consul general in New York, who said the bill could face public backlash as well as opposition by nonorthodox members of Netanyahu’s coalition.

In a short letter to Gallant released by the prime minister’s office on Tuesday night, Netanyahu said he would be replacing Gallant with Katz in the next 48 hours.

Netanyahu also strengthened his coalition on Tuesday night, replacing Katz with the leader of a small right-wing party led by Gideon Saar . This brings Netanyahu’s coalition up to 68 seats in the 120-seat Israeli parliament, or Knesset.

Write to Anat Peled at anat.peled@wsj.com