Parts of the Libyan capital hold out in last attempt to stop rebels tightening their grip on the city

Street battles are continuing to rage in parts of Tripoli after Muammar Gaddafi vowed to fight to the death and his supporters fought a rearguard campaign using snipers, mortars and rockets in a last attempt to stop rebel forces consolidating their grip on the Libyan capital.

A day after the rebels had celebrated their capture of the regime's stronghold at Bab al-Aziziya, the compound came under heavy fire from the pro-Gaddafi area of Abu Salim and the woods around the city zoo, which rebels said were "infested" with snipers. Green flags, the symbol of the ousted regime, and pro-Gaddafi gunmen could still be seen in front of a large building on the edge of the woods once used by Saif al-Islam, one of Gaddafi's sons, to receive guests.

Gaddafi loyalists, who the rebels said were mostly Arab mercenaries, also fired on the road leading to Tripoli airport.

Rebels said 400 people had been killed and 2,000 injured in the battle for Tripoli so far.

Beyond the capital, rebel columns closed in on the coastal city of Sirte, Gaddafi's birthplace, where loyalist troops fired Scud missiles at the rebel-held town of Misrata.

It was unclear whether the fighting was a desperate last stand or the start of a guerrilla campaign by a "stay-behind" force, modelled on the tactics Saddam Hussein and his top lieutenants used in Iraq in 2003.

A pro-Gaddafi radio station broadcast statements by the deposed leader claiming he had "discreetly" toured the capital and "did not feel that Tripoli was in danger". He reportedly said the retreat from his citadel at Bab al-Aziziya had been a tactical move and vowed to fight to the death, calling on his supporters to "cleanse" Tripoli of "devils and traitors".

But in a fresh blow to Gaddafi, the deputy director of foreign security in the Libyan intelligence service, General Khalifah Mohammed Ali, and health minister Mohammed Hijazi, declared their allegiance to rebel forces in interviews aired on al-Arabiya TV. They are among a growing number of Libyan officials who have switched sides since rebels gained the upper hand.

"I put myself in the service of the nation and call on generals and soldiers who are the sons of Libya to join the 17th February revolution," Ali said in the interview with the Dubai-based satellite channel.

In London, the foreign secretary, William Hague, repeated his assertion that the fighting represented "the death throes" of the regime. "I think it is time now for Colonel Gaddafi to stop issuing delusional statements and to recognise what has happened, that control of the country is not going to return, he said in a statement." "He should be telling his dwindling and remaining forces now to stand down."

Rebel fighters continued to hunt for the fugitive despot, reportedly searching the tunnel network beneath Bab al-Aziziya. Mustafa Abdel Jalil, the head of the opposition National Transitional Council (NTC), announced a reward for Gaddafi's capture of 2m Libyan dinars (£1m), funded by a businessman in the rebel stronghold of Benghazi, and an amnesty for past crimes for anyone in his entourage who killed or detained him.

Rebel fighters tried to move into the Abu Salim area, but were kept at bay by heavy sniper and mortar fire from the woods and from high buildings in the district.

Around 35 journalists and diplomats have been freed from the Rixos hotel on the edge of Abu Salim, where they had been held for five days by pro-Gaddafi gunmen. Their release was negotiated by the International Committee of the Red Cross, who ferried the journalists to another hotel elsewhere in the city.

More details emerged of the operation to take control the city, codenamed Mermaid Dawn. According to a rebel military spokesman quoted by AP, men from Tripoli who supported the revolution slipped out of the capital three months ago for training in Benghazi. They then infiltrated the city either by sea, posing as fishermen, or through the western mountains.

"They went back to Tripoli and waited; they became sleeper cells," said military spokesman Fadlallah Haroun, who helped organise the operation. He said that when the signal was given, on 21 August, about 150 men rose up inside Tripoli.

The commander of the battalion charged with defending the entrance to the city, Muhammad Eshkal, was said by another NTC official to have agreed not to put up resistance because Gaddafi had ordered his cousin's death 20 years ago.

A US official was quoted as confirming reports that Qatari special forces had helped spearhead the rebel storming of Bab al-Aziziya, and that British, French and Italian advisers had played a role.

In Paris, Nicolas Sarkozy promised the NTC prime minister, Mahmoud Jibril, that French troops would support the rebels as long as pro-Gaddafi forces resisted. An international conference in the French capital on 1 September, co-ordinated by the British and French governments, would meanwhile mark the transition from military to civilian support for the Libyan revolution.

NTC leaders had been expected to arrive in Tripoli to help bolster the council's legitimacy as an interim government, but it was not clear whether they had put off their trip because of security concerns.

Some NTC officials were involved in talks in Doha with diplomats from a contact group of major powers, aimed at arranging short-term finance for the government. At the UN, US, British and French diplomats were drafting a resolution ordering the unblocking of $1.5bn (£900m) in frozen Libyan funds at the beginning of the war.

Worldwide, Libyan embassies that had not hitherto changed sides, including Tokyo and Addis Ababa, replaced Gaddafi's green flag with the tricolour used by the NTC. In London, NTC officials, who already had control of the embassy, laid a doormat bearing Gaddafi's image so visitors would trample on his likeness.