Updated

Hamas fighters launched a fierce offensive on Gaza City Wednesday, firing mortars and rockets at Fatah's main security bases and the president's compound as the Islamic group appeared close to taking control of the entire Gaza Strip.

• Reporter's Notebook: Hamas Versus Fatah — a Civil War Has Begun

A Hamas military victory in Gaza could split Palestinians into a Hamas-controlled Gaza and a Fatah-run West Bank, and push the prospect of statehood even further away. It could also set the stage for a bloody confrontation with Israel, which might intervene to prevent attacks from Gaza.

In the southern town of Khan Younis, Hamas militants surrounded a security headquarters and warned everyone inside to leave or they would blow it up, witnesses said. The building was then destroyed by a bomb planted in a tunnel underneath it, said Ali Qaisi, a presidential guard spokesman.

PHOTO ESSAY: Hamas and Fatah Gunment Duke It Out in Gaza

An Associated Press reporter saw defeated Fatah fighters streaming out of the building after turning over their weapons to Hamas militants. Hamas took weapons, clothes and vehicles and flew a green Islamic flag over the building, then celebrated by firing in the air and passing out candy.

Security forces later said they had lost control of the town.

"Khan Younis is finished," said Ziad Sarafandi, a senior security official.

At least 20 people were killed in fighting Wednesday. A Hamas militant was killed in a clash early Thursday in the southern town of Rafah, hospital officials said, bringing the total in four days of infighting to over 60. Among those killed Wednesday was a man shot when Hamas gunmen fired on a peaceful protest against the violence, witnesses said.

Palestinian President Mahmoud Abbas of Fatah called the fighting "madness" and pleaded with the exiled leader of Hamas to halt the violence.

Abbas and Prime Minister Ismail Haniyeh of Hamas issued a joint statement after nightfall, calling on all sides "to halt fighting, and to return to language of dialogue and respect of agreements," according to a statement from Abbas' office. The call was broadcast on Palestinian TV.

Hamas radio denied the two had agreed to a truce, and clashes intensified in the hour after their statement was broadcast.

Hamas and Fatah nominally share power in a coalition government, while Fatah runs most of Gaza's security forces. But no one was listening to the elected leaders' pleas for calm as the focus of power passed to street militias.

Hamas gunmen neutralized the main strongholds of the Fatah-linked security forces, ruling the streets and taking control of large parts of Gaza in the process.

Abbas' forces — desperately trying to cling to their besieged bases in Gaza — lashed out at the president, saying he left them with no directions and no support in the fight.

Hamas and Fatah have waged a sporadic power struggle since Hamas won parliament elections last year, ending four decades of Fatah dominance of Palestinian affairs. But the battle is now verging on civil war, as Hamas wages a systematic assault on security forces.

U.N. Secretary-General Ban Ki-moon said he discussed the possible deployment of a multinational force in Gaza with the Security Council on Wednesday after the Israeli and Palestinian leaders raised the idea.

With fighting raging on rooftops and streets in nearly all corners of Gaza, residents huddled in fear in their homes.

Hamas, already in control of much of northern Gaza, seized Khan Younis on Wednesday and began a coordinated assault on the southern town of Rafah, security officials said.

Hamas militants blew up a security building near Rafah after a long gunbattle, said Col. Nasser Khaldi, a senior police official.

"What can I say? This is a fall, a collapse," he said.

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

Fayez Abu Taha, 45, a businessman in Rafah, said he was trapped in his apartment building with his family after Hamas fighters took over a nearby rooftop and Fatah responded by taking over the roof of his building.

"I don't know what they are battling for now," he said. "I can see the bullets flying from my windows. Coming and going."

The rout of the security forces was so bad that 40 Palestinian security officers broke through the border fence in Rafah and fled into Egypt seeking safety, Egyptian police said.

In the afternoon, Hamas forces attacked the three main compounds of the Fatah-allied forces in Gaza City — the headquarters of the Preventive Security, the Intelligence Service and the National Forces — in what could usher in the final phase of the battle.

Hamas fighters, firing rockets and mortar shells, took over the rooftops in nearby houses and cut off the roads to prevent reinforcements from arriving. They called on the beleaguered Fatah forces to surrender.

Hamas gunmen in high-rise buildings also fired at Abbas' Gaza office and house and his guard force returned fire. Abbas was in the West Bank at the time of the fighting.

During the battle at the Preventive Security Service base, both sides fired wildly from high-rise rooftops.

Dr. Wael Abdel Jawad, a physician trapped in his apartment, said he heard Fatah fighters shouting at colleagues on an adjacent roof to send them more ammunition.

"All of us are terrified here. Shooting came through the windows of our apartment, children are screaming. We are hearing from a nearby mosque the call by Hamas to surrender," he said.

"Those fighters on rooftops are like Don Quixote, tilting at windmills. They don't know where to shoot," he said.

In another dramatic battle in Gaza City, hundreds of members of the Fatah-allied Bakr clan, which had fought fiercely for two days, surrendered to masked Hamas gunmen and were led, arms raised, to a nearby mosque. Footage broadcast on Hamas' Al Aqsa TV showed some of the Bakr women trying to enter the mosque. Hamas gunmen later drove off with some of the Bakr fighters, witnesses said.

Two women from the clan tried to leave the area to take a sick girl to a hospital and were shot and killed by jittery Hamas gunmen, a clan member said.

After nightfall, Hamas militants blew up the house of one of the Bakr clan's leaders, witnesses said.

Early Thursday, Fatah officials said their forces withdrew from some bases in central Gaza and destroyed them, rather than allow them to fall into Hamas hands.

In Washington, U.S. officials condemned the fighting.

"Violence certainly does not serve the interest of the Palestinian people, and it's not going to bring the peace and prosperity that they deserve," White House spokesman Tony Snow said.

"They are shooting at anyone and everyone who is Fatah," said Youssef Abu Siyam, a Preventive Security officer in Rafah.

The fighting spilled into the Fatah-dominated West Bank. Hamas and Fatah gunmen exchanged fire in the city of Nablus and a nearby refugee camp after Fatah gunmen tried to storm a pro-Hamas TV production company. Hamas said 12 of its fighters were wounded.

Hamas charged that Fatah-linked security forces were rounding up Hamas activists in the West Bank early Thursday.

On Wednesday, Abbas spoke by phone with the Damascus-based Hamas leader Khaled Mashaal to try to stop the crisis, said Abbas aide Nimr Hamad.

"This is madness, the madness that is going on in Gaza now," Abbas told reporters.

The U.N. Relief and Works Agency, which provides aid to Palestinian refugees, said it would curtail its operations after two of its Palestinian workers were killed by crossfire.

Hamas spokesman Sami Abu Zuhri, said the clashes could have been avoided if Abbas had given the Hamas-led Cabinet control over the security forces, which he blamed for a wave of kidnappings, torture and violence in Gaza.