The three rockets came out of a blue sky with a sound something between a howl and a hiss, exploding with harsh, dry detonations on the far side of the hill from the rebel field hospital outside Sirte.

The staff here, at a converted roadside diner, hardly had time to pick themselves up off the tarmac before the first casualties came in. A rebel soldier was rushed in on a maroon stretcher, his combat trousers torn, a mass of blood soaking through his T-shirt.

The eating area has been converted into an operating theatre, and the young fighter was hauled on to a table, blood dripping on to the marble floor.

Minutes later, more ambulances screamed in, and this time there were howls from the medical staff when the doors of the battered red and white ambulance opened. It was the body of an ambulance driver, a man who had ferried wounded from battlefields dating back to the street fighting in Misrata in March. Now he had no face.

"He's a good friend of mine, I've known him for seven years. He left for duty this morning," sobbed a bespectacled medic as the body was taken to a store room and covered in a blue sheet. More casualties began to arrive as the crump and bump of rockets and artillery erupted over the hill.

Distant plumes of smoke from air-bursts were visible high in the sky. On the highway outside the hospital, a long column of black pickup trucks mounted with anti-aircraft guns thundered past, taking the turning to the left used by units reinforcing rebels inside the city.

Another ambulance arrived with a wounded CNN television producer, Ian Lee, 27, from Wyoming. He had been hit in the ankle by a fragment from a rocket-propelled grenade as the crew watched fighting along the coastal road. "We took fire. I got out to get down. We got hit by some RPGs," he said. "I felt something hit my leg. I rolled over the embankment to get some more cover because we were continuing to take fire."

Three days after a massive rebel force of 900 armed pickup trucks, supported by tanks and Nato bombers, surged into the city that is Muammar Gaddafi's birthplace and final coastal stronghold, loyalist units continue to resist.

It was not supposed to be this way. The rebels dominate the city, have captured the airport and units are surging through the countryside to the south. Yet loyalist forces continue to hold out four weeks after opposition forces arrived in Tripoli to proclaim that the Gaddafi regime was defeated.

"They're crazy, they're mad," said Abdul Baset Hadia, a bearded fighter taking a break from the battle raging in the city. He said loyalist fighters were using civilians as human shields whenever they moved buildings, sending women and children into the street to stop the shooting. "They make a wall of women and children. We can finish it today but we know there are a lot of civilians there. We don't want to kill them."

He said loyalist units were fortified within "Ouagadougou", a sprawling complex in whose great hall Gaddafi had nursed his ambition to be King of Africa. Many African leaders, grateful for the millions of oil dollars he gave them, were happy to applaud him when he held a summit for the Arab League and African Union here in October 2009.

Now the shell-scarred hall has become a bastion for the remnants of his regime: foreign mercenaries who fear death if they are captured rubbing shoulders with members of the Legion Thoria, Gaddafi's secret police, and the survivors of the 32nd brigade, commanded by Gaddafi's son Khamis. The brigade was the tormentor of Misratans, who make up the bulk of the rebel army.

Earlier, at one of the rebel checkpoints around Sirte, Abdyulhakim Abuzakum, a rebel brigade commander from Misrata who trained as an airline pilot in Oxford, had a different explanation for the fanatical resistance of Gaddafi's army.

The reason was the piece of paper he clutched in his hand, containing a list of Gaddafi officials, thugs, soldiers and torturers the rebels want to catch. Many of them are thought to be trapped in Sirte, or to the south-west in Beni Walid, the other Gaddafi stronghold still holding out. And Abuzakum's job is to find them. "We are not Colonel Gaddafi, who kills people for nothing," he said. "If we capture them, they will go to the justice."

He means war crimes trials, for which mountains of evidence has already been gathered. For those found guilty of murder or torture, the penalty is death.

Some rebels believe the loyalist forces still resisting here know they are dead, one way or the other.