SIRTE, Libya (AP) - Moammar Gadhafi's fighters beat back an attempt by Libya's new government Friday to crush remnants of the old regime, forcing revolutionary troops into retreat in the mountains and turning Gadhafi's seaside hometown into an urban battlefield of snipers firing from mosques and heavy weapons rattling main boulevards.
The tough defense of the holdout towns of Sirte and Bani Walid displayed the firepower and resolve of the Gadhafi followers and suggested Libya's new rulers may not easily break the back of regime holdouts. It also raised fears the country could face a protracted insurgency of the sort that has played out in Iraq and Afghanistan.
"The Gadhafi loyalists have so many weapons," cried Maab Fatel, a 28-year-old revolutionary fighter on the front lines in the mountain enclave of Bani Walid, 90 miles southeast of Tripoli.
"This battle is really crazy," Fatel said, his uniform splattered with blood from carrying a wounded comrade.
Revolutionary forces began the day by streaming into Bani Walid but pulled back after intense fighting failed to dislodge pro-Gadhafi snipers and gunners from strategic positions. The two sides traded relentless mortar and rocket fire across a 500-yard-wide desert valley called Wadi Zeitoun that divides the town between north and south.
Mohaned Bendalla, a doctor at a field hospital in nearby Wishtata, said at least six rebels were killed and more than 50 were wounded.
Inside the town, a radio station believed linked to one of Gadhafi's main propagandist kept up a steady stream of appeals to fight and rants that demonized the revolutionaries as traitors who did not honor Islamic values.
"These revolutionaries are fighting to drink and do drugs all the time and be like the West, dance all night," the announcer claimed. "We are a traditional tribal society that refuses such things and must fight it."
Ahmed Omar Bani, a military spokesman for Libya's transitional government, dismissed such allegations, saying the revolutionary forces' only goal was "to liberate our people."
In Sirte, Gadhafi's birthplace on the Mediterranean coast, his backers rained gunfire down from mosque minarets and high-rise buildings on fighters pushing into the city from the west. In the streets the two sides battered each other with high-caliber machine guns, rockets and rocket-propelled grenades.
At one point, a pickup truck filled with revolutionary forces rushed back to the rear lines, its bed bloodied and strewn with the body parts and mangled face of a fighter who had been manning a machine gun. Other fighters shouting "God is great" pulled out his lifeless remains and comforted his partner, the pickup driver.
NATO warplanes swept overhead, but it was unclear whether there were fresh airstrikes to help the anti-Gadhafi advance. The alliance said it struck multiple rocket launchers, air missile systems, armored vehicles and a military storage facility in Sirte on Thursday when revolutionary units launched the offensive.
Gadhafi's spokesman, Moussa Ibrahim, said loyalist forces inflicted a heavy blow Friday on their enemies, killing many and taking many others hostage.
"We have the ability to continue this resistance for months," he said in a phone call to Syrian-based Al-Rai TV, which has become the mouthpiece for the former regime.
Ibrahim said some Gadhafi supporters have infiltrated the revolutionary forces and were working to sabotage them from the inside.
Despite the latest setback, Bani, the military spokesman, said Libya's new rulers hoped to liberate the whole country by the end of this month.
The loyalists still hold a swath of Libya along the central coast and into the southern deserts more than three weeks after revolutionary fighters swept into Tripoli and drove out Gadhafi. The whereabouts of the ousted leader and several of his sons remain unknown.
Hundreds of former rebels have massed deep in the southern desert and were trying to negotiate with villagers in a pro-Gadhafi area to surrender peacefully and avoid bloodshed.
The fighters captured an air base about 45 miles north of the loyalist stronghold of Sabha on Thursday. Col. Bashir Awidat, who is from the Wadi Shati region, said they need to secure the area before moving against Sabha.
Awidat said two former rebels and four loyalists were killed in the fighting, and that they had taken 14 prisoners.
He added the villagers had been isolated and believed Gadhafi's propaganda.
"They think that we'll raid their houses and rob them. The media coverage here has been bad for 42 years and it has trained people to think a certain way, and that will take time to change," he told the Associated Press at the air base.
The new leadership has been gaining international support in its campaign to root out the rest of Gadhafi's regime and establish authority. French President Nicholas Sarkozy, British Prime Minister David Cameron and Turkish Prime Minister Recep Tayyip Erdogan all visited Tripoli this week.
Erdogan joined Friday prayers in Tripoli's Martyrs' Square, the heart of the city once known as Green Square where Gadhafi's regime threw rallies of supporters before his fall.
"You have shown the whole world that no one can stand before the power and the will of the people," Erdogan told a cheering crowd of thousands. He predicted the Syrian regime would be next to fall, saying "the era of autocracy is ending."
The U.N. General Assembly also voted Friday to give Libya's seat in the world body to the National Transitional Council, which is the closest thing the oil-rich North African nation has to a government.
The vote means a senior council official will be able to join world leaders and speak for Libya at next week's ministerial session of the General Assembly, and participate in meetings.
Also Friday, the U.N. Security Council approved a new U.N. mission in Libya and the unfreezing of assets of two major oil companies. It also lifted a ban on flights by Libyan aircraft and modified an arms embargo.
But the fierce resistance in Bani Walid and Sirte underscored how difficult the task of uprooting Gadhafi's last bastions might be. The revolutionary forces have been looming on the outskirts of the two towns for weeks, and attempted another significant assault on Bani Walid last week, only to be repelled by unexpectedly strong loyalist counterattacks.
The fighters made their first big foray into Sirte on Thursday but met a heavy backlash. A roadside bomb struck a bus, killing 11 former rebels on board.
On Friday, smoke rose above the city from heavy fighting, much of it along one of Sirte's main roads, the First of September Street, a date that marks the anniversary of Gadhafi's more than 40-year rule.
Revolutionary forces barraged by sniper fire and rockets let loose with machine guns fixed on the back of pickup trucks.
Nearby buildings were pockmarked with bullet holes. Commanders said they had captured the city's old airport on its western edge.
In Bani Walid, fighters raised the new Libyan flag over an abandoned electricity building before the order to pull back. Around the buildings lay a huge Gadhafi poster bent in half and torn billboards with pictures of the ousted dictator. The walls were still sprayed with graffiti reading, "Long live Moammar."