Explosions and gunfire shake Libyan capital as residents say anti-Gaddafi protesters have taken to the streets

The Libyan capital, Tripoli, was rocked by explosions and gunfire on Saturday, as residents reported clashes with security forces in a number of locations.

Journalists in the city, based at the central Rixos hotel, described hearing heavy gunfire, while residents contacted by news agencies described fighting in opposition areas after a text message was sent out to phones calling on those living in the capital to: "Go out on to the streets and eliminate agents with weapons."

The fighting in Tripoli comes after days of battlefield defeats left Muammar Gaddafi's government and troops penned ever more tightly in the besieged capital. Although the scale of the clashes was impossible to determine, there were widespread claims among the Libyan rebels that Gaddafi's 41-year rule was edging ever closer to collapse.

As gunfire was still audible outside, a government spokesman, Moussa Ibrahim, told reporters the incidents were "isolated" and short-lived. He blamed "armed gangs" of a few dozen rebels who had sneaked into Tripoli, including foreign mercenaries, some of whom had been captured.

"Sure, there were some armed militants who escaped into some neighbourhoods and there were some scuffles, but we dealt with it within a half hour and it is now calm," the spokesman said.

He added: "I ensure Libyans that Gaddafi is your leader … Tripoli is surrounded by thousands to defend it."

Later in the evening news agencies in Tripoli reported that the sound of gunfire appeared to diminish – although why was not clear. "It has become much less," said a Reuters reporter. "Almost a minute went by without the sound of gunfire."

Two Tripoli residents in different parts of the city also said the sound of shooting, which earlier had been intense, had subsided, suggesting Gadaffi's forces remained largely in control. The reports of clashes in Tripoli came in the midst of a febrile mood among rebel forces, who swapped rumours and fired weapons in celebration, convinced that Gaddafi's days are almost over.

One of the few things that was certain was that the long anticipated battle for Tripoli itself – if not here yet – was coming closer.

"We can hear shooting in different places," one Tripoli resident told Reuters. "Most of the regions of the city have gone out, mostly young people … it's the uprising. They went out after breaking the [Ramadan] fast. They are shouting religious slogans: God is greatest!"

Clashes were reported close to the university as well as in the suburb of Tajoura, an opposition stronghold.

Unverifiable reports by rebel sources spoke on Saturday night of heavy casualties on their side. Colonel Fadlallah Haroun, a rebel military commander in their stronghold of Benghazi said it marked the beginning of Operation Mermaid – a nickname for the capital city – an assault on Tripoli co-ordinated with Nato.

"The fighters in Tripoli are rising up in two places at the moment. Some are in the Tajoura neighbourhood and the others near the Matiga airport," he told al-Jazeera.

Mohamad Abdul Rahman, a deputy organiser for the opposition committee inside Tripoli, said that the uprising had erupted inside the capital, with fierce fighting. He said he was in direct contact with rebel commands in Benghazi, Misrata and the western mountains. He added: "We started the uprising in Tripoli without waiting for the other revolutionaries to arrive."

Al-Jazeera said the rebels were now fighting Gaddafi's forces at a bridge 17 miles from Tripoli.

This week's rebel advances on Tripoli – Gaddafi's last major stronghold – have transformed the war by cutting the capital off from its main road link to the outside world and putting unprecedented pressure on the Libyan leader.

Washington says the veteran leader's days are now numbered, and reports have emerged of more defections from his ranks.

The six-month-old war came close to the Tunisian frontier after rebels suddenly seized the coastal city of Zawiyah just 30 miles west of Tripoli, surrounding the heavily fortified capital and severing its vital supply routes. The imposition of a siege around Tripoli has trapped its residents and cut it off from fuel and food supplies.

The International Organisation for Migration said on Friday it would organise a rescue operation to evacuate thousands of foreign workers, probably by sea.

Wild celebrations erupted across Libya after Libyan TV reported that Gaddafi and his two sons had left the country. In the town of Zintan, the opposition stronghold in Libya's western mountains, local people fired wildly into the sky with Kalshnikovs and opened up with anti-aircraft guns as the report spread.