Israeli forces ended a bloody weeklong operation in the Gaza town of Beit Hanoun early Tuesday, leaving behind a swath of destroyed homes, uprooted trees and streets muddied with sewage water from pipes destroyed by tanks and bulldozers.

Nearly 50 Palestinians, most of them militants, and an Israeli soldier were killed in the offensive designed to curb Palestinian rocket fire on Israeli towns. But hours after the troops pulled out, militants began firing rockets again from a field in the town. There were no reports of injuries, but eight Palestinians were killed in clashes in nearby areas, including three killed in a tank strike on a lawmaker's home.

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

The army said it uncovered many weapons and arrested dozens of militants in the operation. Forces took up new positions outside the town, and did not leave the Gaza Strip completely, the military said.

In the dawn light, hundreds of Beit Hanoun residents — who spent most of the last week holed up inside their homes as troops and militants battled in the streets — milled around inspecting the damage the army left behind.

Hundreds climbed over large sand embankments blocking the entrances to the town, making their way in and out of the area that had been a war zone. Women stood outside homes whose outer walls had been damaged by tanks that also ripped up asphalt and cars as they rumbled through streets.

Telephone and electricity wires lay exposed on the ground, and the wall around the town cemetery was in ruins, with several tombstones uprooted. Some residents tried to fix the tombstones, while others dug fresh graves for those killed in the fighting.

Khalil Yazgi, 45, looked on as children and women picked through the rubble of the four-story structure that had been home to his extended family of 50. All that remained was a staircase and the exposed rooms of an apartment.

"If I was against the rockets, now I will encourage people to launch rockets from every spot, from everywhere because rockets are not a pretext for what is going on here," Yazgi said. "This is an act of terror."

In the most dramatic episode of the fighting, militants holed up inside a Beit Hanoun mosque to escape troops who quickly ringed the building with armored vehicles.

On Friday, women loyal to the Palestinians' ruling Hamas group marched to the mosque to free the trapped men. Troops fired on the protesters — many of them women in full Islamic veils — killing two and wounding 10 others.

By Tuesday, the only thing left of the mosque was its minaret. Men stood around the rubble, smoking and trying to salvage torn Korans, the Muslim holy book.

Complete coverage is available in FOXNews.com's Mideast Center.

Hamas sources said Israeli tanks fired two shells on Tuesday at the home of Jamila Shanti, the Hamas lawmaker the group credits with organizing the women's demonstration. Three people were killed. Shanti was not in the house, east of the town of Jebaliya, when the shells struck, and said she had been told her sister-in-law was among the dead.

The army said a tank opened fire after Palestinian militants launched two rocket-propelled grenades at soldiers. It said it was responding to the attack and did not target a specific house.

Clashes continued in nearby towns. Palestinian officials said five militants were killed in the fighting.

On Monday, hours before the army pulled out of Beit Hanoun, a female suicide bomber from Islamic Jihad blew herself up near a group of soldiers. Residents gathered at the site, collecting her remains and taking them to the nearby hospital.

Elsewhere in Gaza on Tuesday, Israeli troops killed two Islamic Jihad militants and two Hamas gunmen.

The pullout from Beit Hanoun coincided with another effort by Palestinian leaders to forge a unity government that they hoped would lead Western countries to lift debilitating economic sanctions. The boycott has caused widespread hardship and made it largely impossible for the Hamas-led government to pay 165,000 civil workers since it took power in March.

Moderate President Mahmoud Abbas of the Fatah Party and Prime Minister Ismail Haniyeh of the Islamic militant group Hamas met for more than two hours late Monday but failed to agree on a unity government. Both sides said the talks — which have broken down in the past — would continue Tuesday.

Officials close to Abbas said the sides have agreed that he would be responsible for foreign affairs and diplomacy in a unity government, and Hamas would be in charge of internal affairs. There is no agreement yet, however, on a candidate for prime minister and how many Cabinet seats each party would hold. The officials spoke on condition of anonymity because they weren't authorized to discuss the negotiations with the media.

Abbas has been urging Hamas, which controls most government functions, to join his moderate Fatah movement in a coalition to end crushing international sanctions.

But the platform of the emerging government remains vague on key international conditions for lifting the boycott: recognition of Israel, renouncing violence and accepting existing peace agreements. Top Hamas leaders also have yet to decide whether to agree to replace the current government with a team of experts.

"There are no major disagreements. We are looking for the best way to have a new government," said Mustafa Barghouti, an independent lawmaker involved in the talks.

A Hamas Web site said the new prime minister would be Health Minister Bassem Naim, a Hamas activist. But some Palestinians officials said Abbas rejected Naim, who has a long anti-Fatah record.

Without the international funds, the Palestinian government is mired in a cash crisis. Public service workers have been striking, but late Monday a teachers' walkout was called off after the Education Ministry pledged to find money to pay the teachers, civil service union head Bassam Zakarneh said.

Teachers were expected to return to their classrooms on Tuesday to prepare for the arrival of students later in the week, officials said.

The school year was to have begun in September.