A weeklong military raid in Nablus, the largest city in the West Bank, ended Thursday, the military said, after soldiers scoured the crowded Old City for militants and kept tens of thousands of residents confined to their homes by a curfew.

Nablus district governor Kamal Sheikh said the Israeli jeeps and bulldozers began leaving the city late in the morning and by afternoon were all gone.

Before the pullout, Israeli troops exchanged gunfire with armed men in a mosque and stormed an apartment building where gunmen were thought to be hiding.

The manhunt was the military's largest West Bank operation since July. The army, which has uncovered three explosives labs in the city this week, says most suicide bombers who have attacked Israeli targets over the past year came from the city, a militant stronghold.

Troops raiding the outlying Al-Faraa refugee camp at dawn Thursday traded shots with three Palestinians holed up in a mosque there, the army and Palestinian officials said. The army said the three men fired at troops from inside the mosque, and that soldiers returned fire.

In downtown Nablus, soldiers left the narrow stone alleyways of the Old City, where the operation had centered since it began on Sunday, lifting a curfew that confined tens of thousands of people to their homes.

The Israelis then regrouped around an apartment building in a newer neighborhood, ringing it with jeeps and armored vehicles, and calling through loudspeakers for the surrender of wanted men thought to be inside. The army said it arrested 10 wanted militants during the operation. One Palestinian civilian was killed.

Palestinian leaders have charged that the raid was an Israeli attempt to undermine Palestinian efforts to form a unity government. Hamas and the rival Fatah movement are trying to finalize a power-sharing deal that they hope will halt months of infighting and reinstate at least some frozen international funding.

Visit FOXNews.com's Mideast Center for more in-depth coverage.