Supporters of Muammar Gaddafi have put up fierce resistance against offensives trying to storm two of the deposed Libyan leader's last strongholds.

Loyalists forced the National Transitional Council's fighters into retreat in the mountains on Friday, and turned Sirte into an urban battlefield.

In the mountain enclave of Bani Walid, about 140km southeast of Tripoli, NTC forces pulled back after a day of intense fighting that failed to dislodge pro-Gaddafi sharpshooters in strategic positions.

In Sirte, Gaddafi's birthplace on the Mediterranean coast, his backers rained gunfire down high-rise buildings on fighters pushing into the city from the west, while in the streets the two sides battered each other with high-caliber machine guns, rockets and rocket-propelled grenades.

Live Box 20115613924415945

The tough defence displayed the firepower and resolve of the Gaddafi followers and suggested Libya's new rulers may not easily push aside the remnants of the old regime.

"They had to retreat [from Bani Walid] because they came under heavy shelling by Gaddafi forces," Al Jazeera's Hoda Abdel Hamid, reporting from Ras Lanuf, said.

"The fighters also had to retreat from Sirte due to fierce retaliation by Gaddafi forces."

Gaddafi's spokesman, Moussa Ibrahim, in hiding like his leader, spoke after the fighting on Friday, telling the Syria-based Arrai TV channel about the NTC retreat and again warning that pro-Gaddafi forces were gathering arms and equipment in preparation for a "long war".

"The battle is far from over," he said. "We assure everybody that the Sirte and Bani Walid fronts are strong, despite the heavy, unbelievable and merciless NATO bombardment on hospitals, families and schools."

Regime holdouts

The twin assaults appeared to be a co-ordinated attempt to break the back of regime holdouts, who still control territory along the central coast and into the southern deserts, more than three weeks after NTC fighters swept into Tripoli and drove out Gaddafi.

The whereabouts of Gaddafi and at least two of his sons remain unknown.

The new leadership has been gaining international support in their campaign to root out the rest of Gaddafi's regime and establish their authority, with high-profile visits on Thursday by the French president and British prime minister, and on Friday by the Turkish prime minister, Recep Tayyip Erdogan.

Erdogan joined Friday prayers in Tripoli's Martyrs' Square, the heart of the city once known as Green Square, where Gaddafi's regime threw rallies of supporters before his fall.

The NTC forces have been looming over the two cities for weeks, and last week they attempted a significant assault on Bani Walid, only to be repelled by unexpectedly strong loyalist counterattacks.

The fighters made their first big foray into Sirte on Thursday, also meeting a heavy backlash.

Smoke rose above the city from heavy street fighting on Friday, much of it along the main First of September Street running into the city from the west.

The fighters let loose with machine guns fixed on the back of pick-up lorries. Nearby buildings were pockmarked with bullet holes.

Commanders said they had captured the city's old airport on its western edge.

NATO fighter jets swept overhead, but is was unclear whether there were new air strikes to help the anti-Gaddafi advance. The alliance said it struck multiple rocket launchers, air missile systems, armoured vehicles and a military storage facility in Sirte on Thursday.

On the political front on Friday, the UN gave Libya's seat to the transitional authorities, bringing the recognition of Gaddafi's government to a formal end.

The UN also passed a resolution easing sanctions on the country, allowing Libya's national oil company and central bank to resume operations. It means Libya's national oil company and central bank can resume operations following the conflict.

Source: Al Jazeera and agencies