Cheering Hamas supporters wearing green headbands and waving flags surged through Gaza's streets Friday as Islamic militants in black masks took over one of President Mahmoud Abbas' offices and rifled through his bedroom.

Hamas offered amnesty to its defeated foes as violence tapered off from five days of bloodshed that claimed more than 90 lives. But Fatah leader Abbas made the split complete by firing the Hamas prime minister, leaving Palestinians struggling to adjust to a new political reality that has crushed their long-standing hopes for their own state.

Safe in the West Bank, Abbas moved quickly to cement his rule there after losing control of Gaza to Hamas forces. He replaced Prime Minister Ismail Haniyeh, a Hamas member, with Finance Minister Salam Fayyad, a respected economist, to head a new moderate government.

Hamas, overwhelmingly elected in a 2006 parliament vote, denounced Abbas' move as a coup. Hamas' supreme leader, Syrian-based Khaled Mashaal, later said Abbas has legitimacy as an elected president and promised to cooperate, but warned Fatah against going after Hamas loyalists in the West Bank.

But Fatah gunmen and security forces allied with Abbas in the West Bank were prowling that territory looking for Hamas supporters and wrecking a Hamas radio station.

The sparring made little difference on the ground: The two Palestinian territories, on either side of Israel, are now separate entities with two governments — one run by Hamas and backed by radical Islamic states, and the other controlled by the Western-supported Fatah.

Abbas received immediate pledges of support from Israel, the U.S., Egypt, Jordan, the U.N. and Saudi Arabia.

Israeli Prime Minister Ehud Olmert told Egyptian President Hosni Mubarak by phone that he would take steps to bolster Abbas. Officials in Olmert's office said he would consider releasing hundreds of millions of dollars in tax receipts frozen after Hamas came to power.

Though the moderate government that Abbas plans to appoint will have no say in Gaza, it stands a stronger chance than the Hamas-Fatah coalition it replaces of restoring foreign aid to the West Bank.

The yearlong aid embargo imposed after the Hamas election victory has crippled the Palestinian economy, and many Gazans feared they would become even more isolated and impoverished.

In a West Bank hotel, several Fatah loyalists who fled Gaza sat in the lobby chain-smoking and worked the phones to set up new lives, hearing from relatives in Gaza that their homes had been searched.

In Gaza City, a government worker who ran the operations room in the main police compound, called his old office and pleaded with the new Hamas rulers to care for the computers. He gave only his first name, Hani, because he feared for his safety despite Hamas' amnesty offer.

Several thousand Hamas supporters in Gaza cheered as a small armored personnel carrier seized from Abbas' forces rolled into the Palestinian legislature compound, where a victory march was held.

A jubilant crowd chanted slogans and waved green Hamas flags as gunmen fired in the air. Many wore green hats and headbands. Excited children climbed over the vehicle, and bearded armed men strutted around the parliamentary building, grinning from ear to ear.

Hamas was both cocky and conciliatory.

It released nine senior Fatah leaders and many lower-ranking activists, saying it was granting amnesty to its rivals. Hamas spokesman Abu Obeideh also promised to get BBC journalist Alan Johnston, held since March, released quickly. He said Hamas has made contact with the captors and is taking "serious and practical steps" to win his release.

Yet Hamas gunmen also entered the seaside compound used by Abbas on visits to Gaza, rifling through the president's belongings in his bedroom, next to his office. They lifted the mattress and searched drawers.

One gunman sat at the desk of the Fatah leader, who is also known as Abu Mazen, picked up the phone and pretended to call Secretary of State Condoleezza Rice. "Hello, Rice?" the gunman said. "Here we are in Abu Mazen's office. Say hello to Abu Mazen for me."

Gaza's streets, deserted during the fighting, were crowded with cars, pedestrians and triumphant Hamas fighters, some driving in jeeps and firing in the air.

Haniyeh, the prime minister fired by Abbas, promised to restore security to the anarchic territory. He urged Gazans to display "self-restraint" and end the widespread looting of houses and other property of Fatah officials.

Looters stripped the home of Fatah strongman Mohammed Dahlan of everything from windows and doors to flowerpots. "This was the house of the murderer Dahlan that was cleansed by the holy warriors," read graffiti sprayed on the wall.

Donkey carts outside the house waited to take more loot. Dahlan was in Egypt when the fighting erupted, and reached the West Bank on Thursday.

Gaza City's Shifa Hospital was still grappling with battle casualties. More than 90 people were killed in the fighting and dozens wounded. The morgue was overflowing, with four bodies lined up on the floor, and some of the wounded were sleeping on cardboard on the floor.

Two men were killed in revenge slayings Friday, including a Fatah gunman thrown from a roof in what Hamas described as a family grievance — the gunman, they said, had killed a member of a Hamas-allied family. Another Fatah loyalist was shot dead in southern Gaza.

Since Hamas' victory late Thursday, about a dozen Fatah gunmen had been killed in gangland-style executions, Fatah said.

Before word came of Hamas' amnesty offer, 97 Fatah officials fled in a fishing boat to Egypt. Others reached Israel via the Erez crossing and headed to the West Bank.

An Egyptian security delegation left Gaza after failing in its mediation efforts between the warring Palestinian factions.

Both the United Nations and the European Union reiterated support Friday for Abbas. Arab League foreign ministers also threw their support behind Abbas, but urged an immediate halt to infighting so that the unity of Palestinian lands can be preserved.

Hamas' military takeover of Gaza formalized the separation between Gaza and the West Bank, and was a major setback to dreams of Palestinian statehood.

With a larger middle class, more foreign passport holders and more contact with the outside world, many West Bank residents have long felt they have little in common with Gaza.

"I expect to have economic development here and poverty there in Gaza," Salah Haniyeh, a government employee, said as he watched masked Fatah gunmen parading in pickup trucks through the West Bank city of Ramallah.

Across the West Bank, Fatah gunmen backed by Abbas-allied security forces expanded an anti-Hamas sweep. Dozens of Hamas supporters had been seized by gunmen or arrested by police since Thursday.

In the city of Nablus, a Hamas stronghold, Fatah gunmen set up checkpoints and barred access to the Hamas-run municipal building. Gunmen also vandalized a Hamas media office in Nablus, trashing computers and furniture.

"We will go after them (Hamas) everywhere," said Mouin Hijazi, a Nablus leader of the Al Aqsa Martyrs' Brigades, a violent Fatah offshoot. "We won't allow them to continue existing in the West Bank."

In Gaza, an immediate concern was how long the coastal strip would be sealed. Gaza's main passenger and cargo crossings, with Egypt and Israel, were closed this week, and it was not clear when they would reopen. Extended closure could quickly lead to a humanitarian crisis.

A Hamas spokesman said Palestinian police, now under Hamas command, would take up positions at the crossings, but it was unlikely Israel would agree to such a deployment because Hamas militants frequently attacked the passages in the past.

John Ging, head of U.N. aid operations in Gaza, said his agency would resume work Saturday. The U.N. Relief and Works Agency provides emergency food rations and health care to hundreds of thousands of Gazans. He called for a quick reopening of the Gaza crossings.