Israel’s military said on Wednesday that it had withdrawn from the occupied West Bank city of Jenin after a large-scale incursion that killed at least 12 Palestinians, left one Israeli soldier dead and sent thousands fleeing from their homes over the past two days.

Israel’s chief military spokesman, Rear Adm. Daniel Hagari, said the operation in Jenin, which focused on the refugee camp in the city, was over. “All our troops are out of the camp,” he told Kan News, Israel’s public radio station. But he said he expected that the Israeli military would have to return to the area in the future.

The assault on Jenin began on Monday with the most intense Israeli airstrikes on the West Bank in nearly two decades. Israel said it was aimed at rooting out armed Palestinians after dozens of shooting attacks on Israelis had originated from the area over the past year.

Jenin is known as a stronghold for the two main Palestinian militant groups, Islamic Jihad and Hamas. But it is also home to newer armed groups that have sprung up and do not answer to the established organizations. The city had been at the center of escalating tensions and violence in the year leading up to the incursion.

The violence this week ratcheted up tensions in the region, which were already high after the most right-wing government in Israeli history took power six months ago. The coalition government’s leaders promised to expand Jewish settlements in occupied territory and to offer up a tougher response to violence.

At the same time, the Palestinian Authority, which administers parts of the occupied West Bank, has increasingly lost control of hotbeds of militancy in areas under its authority.

Leaders of Hamas and the Islamic Jihad declared victory late on Tuesday as signs emerged of an Israeli pullout.

Israeli officials said the incursion was never intended to conquer or hold territory in Jenin.

Even as Palestinian militant groups celebrated the retreat of Israeli troops, sirens blared in Israeli towns near the Gaza Strip after five missiles were fired from the Palestinian enclave, the Israeli military said. No injuries were immediately reported and Israel said its air-defense system intercepted all five.

In response to the rocket fire, Israeli fighter jets struck what the military described as an underground facility used for manufacturing weapons and another site used for the production of raw rocket materials, according to posts on Twitter. Israel linked both sites to Hamas, the Palestinian militant faction that controls Gaza.

Among the 12 Palestinians killed in the Jenin operation, four were under 18, the Palestinian Health Ministry said, and at least five were claimed by Palestinian militant groups as fighters, including a 16-year-old boy. Israel said that all of the Palestinians who had been killed so far were combatants. But the Palestinian authorities did not specify whether those who died were all combatants or included civilians.

A spokesman for the Israeli Defense Forces said on Twitter that a soldier had been killed by gunfire during the military operation in Jenin on Tuesday evening. His death was still under investigation, the Israeli authorities said, leaving open the possibility that the soldier may have been killed by friendly fire.

Yaakov Shabtai, the Israeli police chief, told reporters that the assault on Jenin had the potential to fuel a rise in retaliatory attacks.

In Tel Aviv on Tuesday, a Palestinian driver wounded eight people in a car-ramming and stabbing attack, Israeli officials said. The assailant was shot and killed by a civilian, Israeli security officials said.

Hamas claimed the attacker as one of its members and praised the attack as a response to “the Zionist occupation’s aggression in Jenin.” But Palestinian groups have been known to claim as members or publicly honor all of those killed by Israel, and Hamas stopped short of taking direct responsibility for the assault.

The operation led to displacements of residents in the densely populated refugee camp, where the attack was focused. As many as 3,000 of the camp’s roughly 17,000 residents sought shelter in schools and other public buildings, or with families elsewhere.

Some Palestinian officials said that Israel had threatened and forced camp residents to evacuate their homes.

“Houses have been demolished, broken into, and the people were forced out of their own homes,” the mayor of Jenin, Nidal Obeidi, told the radio station Voice of Palestine on Tuesday.

Israeli officials denied that they had carried out any forced evacuations but confirmed that some residents had received text messages from Israeli numbers advising them to leave their homes temporarily.

About 1,000 Israeli troops searched the camp on Tuesday after earlier finding and confiscating caches of weapons, explosive devices and other military equipment, according to the Israeli military, which added that its forces had also destroyed laboratories for manufacturing explosives.

Clashes between Israeli soldiers and Palestinian militants intensified on Tuesday evening after a relatively calmer period of scattered firefights. The Israeli military said its air force had struck Palestinian militants on the city’s outskirts, while Palestinian officials accused Israeli soldiers of firing tear gas into a hospital. The Israelis denied any attacks near hospitals.

The chief military spokesman, Admiral Hagari, said on Tuesday that 120 wanted men had been arrested and were being interrogated by the security services.

“There is no point in the camp that we have not reached,” Admiral Hagari wrote on Twitter on Tuesday.

Gabby Sobelman contributed reporting from Rehovot, Israel; Myra Noveck from Jerusalem; and Iyad Abuheweila from Gaza City.