By Mohammed Abbas
AJDABIYAH, Libya (Reuters) - Muammar Gaddafi's forces wrested back part of a town in western Libya from rebels, but his foes said they had seized the oil port of Ras Lanuf, expanding their grip in the east of the country in a two-week-old uprising.
Counter-attacks by Gaddafi loyalists this week suggest the flamboyant autocrat in power for 41 years will not go quietly or relatively quickly as leaders in neighboring Egypt and Tunisia did in a tide of popular unrest rolling across the Middle East.
An upsurge of fighting appears to be cementing a de facto split of the oil-producing desert state, Africa's fourth biggest, into a government-held western area round the capital Tripoli and an eastern region held by ragged but dedicated rebel forces.
In diplomacy aimed at quelling upheaval that has jacked up oil prices, a group of mostly Latin American states in a leftist bloc behind Venezuelan President Hugo Chavez endorsed his plan on Friday for an international mediating mission on Libya.
But Chavez's chances looked slim for now since the rebels have ruled out talks unless they lead to Gaddafi's resignation or exile, outcomes he has categorically ruled out.
Disaffected Libyans see Chavez as too close to Gaddafi, whom the Venezuelan leader calls a friend. It was unclear whether the plan has gained any traction with other countries.
In Zawiyah, a town 50 km (30 miles) west of Tripoli whose control by rebels had embarrassed the government, "dozens were killed and more were wounded" by pro-Gaddafi forces, said Mohamed, a resident. "We have counted 30 dead civilians."
Loyalist forces used grenade-launchers, heavy machineguns and snipers on a hotel roof to fire at protesters marching through town after Friday prayers to demand Gaddafi's resignation, Mohamed said.
Rebel fighters retreated but were still holding the central Martyrs Square later in the day, a rebel spokesman said.
A Libyan government official said the town had fallen. "It's been liberated, maybe there are still some pockets (under rebel control) but otherwise it's been liberated."
In the east, rebels said they had captured the airport of Ras Lanuf and later the Mediterranean oil town itself, which lies on a strategic coast road 660 km (410 miles) from Tripoli.
"We have taken Ras Lanuf 100 percent, Gaddafi's forces have all left," rebel soldier Hafez Ibrahim said from the town. He did not say who controlled the military base and oil terminal.
A deputy foreign minister in Tripoli disputed this, telling reporters that government forces still held the town.
Rebels have already seized control of much of the rest of eastern Libya, where Libya's oil fields are concentrated and opposition to Gaddafi has traditionally been strongest, in a popular uprising centered on Benghazi, Libya's second city.
The revolt is the bloodiest yet against long-entrenched rulers common across the Middle East and North Africa. The past few weeks saw the overthrow of the veteran presidents of Tunisia and Egypt -- Libya's western and eastern neighbors.
A rebel spokesman said pro-Gaddafi forces bombed an arms depot -- one of the biggest weapons stores in the eastern region -- on the outskirts of Benghazi on Friday.
"A lot of people have been killed. There are many people in the hospital. No one can approach, it's still very dangerous," said a resident who would only identify himself as Saleh.
Security forces cordoned off the area, and a Reuters witness said at least eight ambulances ferried away casualties. Windows shattered in suburbs several kilometers away, residents said.
News of the fighting thrust U.S. crude prices to their highest levels since September 2008, and Brent crude futures for April delivery rose $1.36 to $116.17 a barrel.
The International Energy Agency said the revolt had blocked about 60 percent Libya's 1.6 million bpd (barrels per day) oil output.
CHAOTIC FLIGHT OF FOREIGN WORKERS
The upheaval has caused a humanitarian emergency on the Tunisian border where tens of thousands of foreign workers have fled to safety. An international airlift is under way, reducing the number of refugees stranded in tented camps.
The rebels earlier told Reuters any talks must yield the departure of Gaddafi after attacks on civilians that have provoked international condemnation, arms and economic sanctions and an international war crimes investigation.
Western leaders have urged Gaddafi to go and are considering various options including the imposition of a no-fly zone, but are wary about involving their militaries after wars in Afghanistan and Iraq deeply unpopular at home.
In Tripoli, shooting rang out across Tajoura district as Gaddafi loyalists broke up a crowd of protesters seeking an end to his long rule and shouting "Gaddafi is the enemy of God!"
The demonstrators spilled out of the Murat Adha mosque after Friday prayers, and several hundred began chanting for an end to Gaddafi's four decades in power. A pro-Gaddafi rally in Tripoli's central Green Square later drew several hundred demonstrators, many waving green flags.
(Additional reporting by Maria Golovnina, Michael Georgy, Yvonne Bell and Chris Helgren in Tripoli, Tom Pfeiffer and Alexander Dziadosz in Benghazi, Souhail Karam and Marie-Louise Gumuchian in Rabat, Yannis Behrakis and Douglas Hamilton on Tunisia border; Christian Lowe and Hamid Ould Ahmed in Algiers; Deisy Buitrago in Caracas; Writing by Mark Heinrich; editing by Miral Fahmy)