Yussef Eissa, the Preventive Force chief, said that Hamas had planted a bomb in a tunnel underneath the security force compound in Khan Yunis.

At least three people were killed in the blast, according to medics.

Witnesses said that Hamas fighters had warned the officers inside the building to come out or they would blow the building up.

"Khan Yunis is finished, but we are still holding on in Rafah," Ziad Sarafandi, a senior security official, told the Associated Press.

Soon after, Hamas fighters blew up a second security building near Rafah after a long gun battle, Colonel Nasser Khaldi, a senior police official, said.

"Hamas surrounded the building, they had come from Khan Yunis to Rafah, they are working by plan."

Gaza City attacks

On Wednesday evening it was reported that Hamas had attacked the three main security force compounds in Gaza City - the headquarters of the Preventive Security, the Intelligence Service and the National Forces.

Armed men had taken over the rooftops of nearby houses and cut off the surrounding roads to prevent reinforcements from arriving, residents said.

Palestinian fighting forces

Izz al-Din al-Qassam Brigades:

- Armed wing of Hamas- Estimated 15,000 members-Well armed

Executive Force:- Security force set up by Hamas in 2006- Estimated 6,000 personnel- Mainly drawn from armed wing of Hamas

Presidential Guards:- Majority loyal to Fatah - Up to 5,000 personnel- Best equipped and trained security force- US gave $43m to help restructure force

National Security Forces:- Under direct command of president- Includes military intelligence, naval police and Elite Force 17- Up to 30,000 personnel

Al-Aqsa Martyrs Brigades:- Offshoot of Fatah faction- Several thousand members- Many work for the security services

Dr Wael Abdel Jawad, a physician trapped in his apartment, said he heard security forces 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.

Hamas fighters have also reportedly taken control of the coastal strip's main north-south road, putting them in position to cut off reinforcements to the security forces.

After tightening its control on the northern Gaza Strip early on Wednesday, the armed wing of Hamas demanded that the security forces in the area hand over their weapons by Friday at 1600GMT.

Dozens of security personnel have reportedly fled across the border into Egypt to escape the fighting.

About 40 pro-Fatah officers broke though the border fence at the Rafah crossing, handing over their weapons to Egyptian border officials, a security source said.

In what appeared to be another success for Hamas, hundreds of members of a clan linked with Fatah surrendered in Gaza City, witnesses said.

Fighting 'madness'

Abbas described the situation in the Gaza Strip as "madness" and called for an immediate halt to the violence.

"Without a stop to fighting, I believe that the situation will collapse in Gaza," he said.

Hours later, a Hamas spokesman offered a conditional ceasefire under which the interior minister, a cabinet post held by the group, would command all of the Palestinian security services.

"[Egyptian mediators] received the proposal and promised to present it to Abbas. The ball is now in [his] court. Hamas does not set impossible conditions, and if there are serious intentions to resolve the crisis, we will be ready to reciprocate," Sami Abu Zuhri said.

Meanwhile, the UN Relief and Works Agency (UNRWA) suspended all operations except emergency medical and food programmes in the Gaza Strip after two Palestinian employees were shot dead.

Christopher Gunness, UNRWA spokesman, said they appeared to have been caught in the crossfire in two separate incidents.

"In view of increased threats to our staff, UNRWA has no choice but to scale back its operations in Gaza with immediate effect," he said.

'Stop the killing'

About 1,000 Palestinians marched through Gaza City on Wednesday urging the rival factions to "stop the killing".

More than 60 Palestinians are estimated to have died since the fighting resumed four days ago.

Al-Aqsa Martyrs' Brigades fighters forced their way into a pro-Hamas TV station [AFP]

The demonstration drew gunfire from armed men on nearby buildings killing at least one protester and injuring 14 others. It was not immediately clear who was responsible for the shooting.

Nour Odeh, Al Jazeera's correspondent in Gaza, said some of the protesters fought with members of the rival factions on the street.

The fighting also spilled over into the previously calm West Bank as fighters from the Fatah-linked al-Aqsa Martyrs' Brigades stormed a building in Nablus used by a pro-Hamas television company.

Walid Batrawi, Al Jazeera's correspondent in the West Bank, said at least 15 people working in the office were abducted and taken to a nearby refugee camp.

"This is an escalation that is alarming in the West Bank if it spreads to other areas," he said.