Fighters loyal to Libya's overthrown leader Muammar Gaddafi took control of a town south-east of the capital on Monday, flying their green flags in defiance of the country's fragile new government.
The fightback by Gaddafi supporters defeated in Libya's civil war, though unlikely to spread elsewhere, added to the problems besetting a government which in the past week has been reeling from one crisis to another. Gaddafi himself was captured and killed in October after weeks on the run.
Accounts from the town of Bani Walid, about 200 km (120 miles) from Tripoli, described armed Gaddafi supporters attacking the barracks of the pro-government militia in the town and then forcing them to fall back.
"They control the town now. They are roaming the town," said a fighter with the 28th May militia, loyal to Libya's ruling National Transitional Council (NTC), which came under attack.
The fighter told Reuters the loyalists were flying "brand new green flags" from the centre of town. The flags were symbols of Gaddafi's 42-year rule.
A resident said four people were killed and 20 wounded in the fighting, during which the sides used heavy weapons.
Bani Walid, base of the powerful Warfallah tribe, was one of the last towns to surrender to the anti-Gaddafi rebellion last year. Many people there oppose the new leadership.
A Libyan air force official said war planes were being mobilised to fly to Bani Walid . A spokesman for the military council in Zawiyah, near Tripoli, said a 1,500-strong force, drawn from militias across western Libya, was on stand-by.
"If the situation in Bani Walid is still complicated , we will go there," the spokesman, Ayad Laaroussi, said.
But it was not immediately clear what the government in Tripoli could do. It has yet to demonstrate that it has an effective fighting force under its command and Bani Walid, protected behind a deep valley, is difficult to attack.
The uprising in Bani Walid could not come at a worse time for the NTC. In the past week its chief has had his office overrun by protesters angry at the slow pace of reform and the second most senior official has quit, citing what he described as an "atmosphere of hatred."
During Libya's nine-month war, anti-Gaddafi rebels tried to take Bani Walid but did not progress much beyond the outskirts of the town. It later emerged that Saif al-Islam, one of Muammar Gaddafi's sons who was captured in the Sahara desert in November, had been using Bani Walid as a base.
Soon before the end of the conflict, with Gaddafi's defeat unavoidable, local tribal elders negotiated an agreement under which forces loyal to the NTC were able to enter the town without a fight.
Relations have been uneasy since then and there have been occasional flare-ups of violence.
The resident, who did not want to be identified, said Monday's violence began when members of the May 28 militia arrested some Gaddafi loyalists.
That prompted other supporters of the former leader to attack the militia's garrison.
"They massacred men at the doors of the militia headquarters," said the resident.
A militia based in Tripoli said its fighters had captured 17 people who, it said, were part of a network trying to smuggle arms to Gaddafi loyalists in Bani Walid and elsewhere. The militia said in a text message that the weapons included Russian-made Grad rockets.
The NTC still has the backing of the NATO powers who, with their diplomatic pressure and bombing campaign, helped push out Gaddafi and install the new government.
But questions are now being raised inside some Western governments about the NTC's ability to govern Libya effectively and secure its borders against al Qaeda, arms traffickers and illegal migrants trying to get into Europe.
The NTC was pitched into its worst crisis since the end of the civil war at the weekend when a crowd of protesters in the eastern city of Benghazi stormed the council's local headquarters when NTC chief Mustafa Abdel Jalil was inside.
The protesters, who supported the revolt against Gaddafi, were angry that more progress had not been made to restore basic public services. They also said many of the NTC's members were tarnished by having served in Gaddafi's administration.
Abdel Hafiz Ghoga, deputy head of the NTC and target of some of the protests, said he was resigning. Abdel Jalil warned that the protests could drag the country into a "bottomless pit."