AL-MAYA, Libya (Reuters) - Muammar Gaddafi urged Libyans to take up arms and crush an uprising in Tripoli as rebel troops closed on the capital for a final onslaught on his stronghold.
"I am afraid if we don't act, they will burn Tripoli," he said in an audio address broadcast on state television. "There will be no more water, food, electricity or freedom."
Thousands of rebel fighters 25 km (15 miles) west of Tripoli were moving towards the capital on Sunday evening. As they advanced, they took control of a barracks belonging to the Khamis brigade, an elite security unit commanded by one of Gaddafi's sons, Khamis.
In a coordinated revolt that rebel cells had been secretly preparing for months, shooting started on Saturday night across Tripoli, moments after Muslim clerics, using the loudspeakers on mosque minarets, called people on to the streets.
Gaddafi, in his second audio broadcast in 24 hours, dismissed the rebels as rats.
"I am giving the order to open the weapons stockpiles," Gaddafi said. "I call on all Libyans to join this fight. Those who are afraid, give your weapons to your mothers or sisters.
"Go out, I am with you until the end. I am in Tripoli. We will...win."
The fighting inside Tripoli, combined with rebel advances to the outskirts of the city, appeared to signal the decisive phase in a six month conflict that has become the bloodiest of the "Arab Spring" uprisings and embroiled NATO powers.
"Gaddafi's chances for a safe exit are diminishing by the hour," said Ashour Shamis, a Libyan opposition activist and editor based in Britain.
But Gaddafi's fall, after four decades in power, is far from certain. His security forces did not buckle, and the city is much bigger than anything the mostly amateur anti-Gaddafi fighters, with their scavenged weapons and mismatched uniforms, have ever tackled.
If the Libyan leader is forced from power, there are question marks over whether the opposition can restore stability in this oil exporting country. The rebels' own ranks have been wracked by disputes and rivalry.
Rebels said after a night of heavy fighting, they controlled a handful of city neighbourhoods. Whether they hold on could depend on the speed with which the other rebels reach Tripoli.
"The rebels may have risen too early in Tripoli and the result could be a lot of messy fighting," said Oliver Miles, a former British ambassador to Libya. "The regime may not have collapsed in the city to quite the extent they think it has."
But the rebel advance towards the city was rapid, and there was no sign of fierce resistance from Gaddafi's security forces. In the past 48 hours, the rebels west of Tripoli have advanced about 25 km, halving the distance between them and the capital.
Government forces put up a brief fight at the village of Al-Maya, leaving behind a burned-out tank, and some cars that had been torched. "I am very happy," said one resident.
The anti-Gaddafi fighters paused long enough to daub some graffiti on walls in the village. One read "We are here and we are fighting Gaddafi," another, "God is great." They then moved on towards Tripoli.
In Benghazi, the eastern Libyan city where the anti-Gaddafi revolt started and where the rebels have their main stronghold, a senior official said everything was going according to plan.
"Our revolutionaries are controlling several neighbourhoods and others are coming in from outside the city to join their brothers at this time," Abdel Hafiz Ghoga, vice-chairman of the rebel National Transition Council, told Reuters.
A spokesman for Gaddafi, in a briefing for foreign reporters, underlined the message of defiance.
The armed units defending Tripoli from the rebels "wholeheartedly believe that if this city is captured the blood will run everywhere so they may as well fight to the end," said the spokesman, Moussa Ibrahim.
"We hold Mr Obama, Mr Cameron and Mr Sarkozy morally responsible for every single unnecessary death that takes place in this country," he said, referring to the leaders of the United States, Britain and France.
A diplomatic source in Paris, where the government has closely backed the rebels, said underground rebel cells in the capital had been following detailed plans drawn up months ago and had been waiting for a signal to act.
That signal was "iftar" -- the moment when Muslims observing the holy months of Ramadan break their daily fast. It was at this moment that imams started broadcasting their message from the mosques, residents said.
But the overnight fighting inside the city, while fierce, was not decisive. Rebels said they controlled all or parts of the Tajourah, Fashloom and Souk al-Jumaa neighourhoods, yet there was no city-wide rebellion.
In Tripoli on Sunday, the two sides appeared to be jockeying for control of roof terraces to use as firing positions, possibly in preparation for a new burst of fighting after dark.
A rebel activist in the city said pro-Gaddafi forces had put snipers on the rooftops of buildings around Bab al-Aziziyah, Gaddafi's compound, and on the top of a nearby water tower.
As he spoke, single gunshots could be heard in the background, at intervals of a few seconds.
"Gaddafi's forces are getting reinforcements to comb the capital," said the activist, who spoke by telephone to a Reuters reporter outside Libya.
"Residents are crying, seeking help. One resident was martyred, many were wounded," he said. It was not immediately possible to verify his account independently.
State television flashed up a message on the screen urging residents not to allow rebel gunmen to hide on their rooftops.
"Agents and al Qaeda members are trying to destabilise and sabotage the city. You should prevent them from exploiting your houses and buildings, confront them and cooperate with counter-terrorism units, to capture them," it said.
Additional reporting by Missy Ryan in Tripoli, Robert Birsel in Benghazi, Libya, William Maclean in London, Hamid Ould Ahmed in Algiers; Writing by Christian Lowe; Editing by Ralph Boulton