* Libya sees fiercest clashes since fall of Gaddafi
* Shelling between militias continues in Tripoli
* Benghazi battles involve troops, aircraft (Add details on PM, airports)
By Patrick Markey and Aziz El Yaakoubi
TRIPOLI, July 24 (Reuters) - Heavy black smoke rose over southern Tripoli on Thursday after rival militias exchanged artillery and rocket fire in a battle over the Libyan capital's airport that has killed around 50 people in nearly a fortnight of fighting.
Sporadic blasts echoed across the city since the morning in clashes that have deepened fears of post-war Libya becoming a failed state, with a fragile government unable to control heavily armed brigades battling for power.
Fighting in the capital and the eastern city of Benghazi, its heaviest since the 2011 war that ousted Muammar Gaddafi, has led most international flights to Libya to be canceled and has prompted the United States to pull out embassy staff.
A Health Ministry official in Tripoli was unable to provide details of Thursday's casualties because he could not contact hospital staff in the area. One local doctor said at least 30 injured were at his hospital in Tripoli on Wednesday.
The Mitiga hospital in Tripoli said it was in an emergency situation because of a lack of resources and the inability of many employees to get to work due to the fighting and gasoline shortages, state news agency LANA reported.
Underscoring Libya's chaos, acting Prime Minister Abdullah al-Thinni said on Thursday that he was prevented by militias from flying from an airport outside Tripoli.
"Groups controlling Mitiga Airport prevented acting Prime Minister Abdullah al-Thinni and ministers from flying to the eastern city of Tobruk," a statement from his office said.
Mitiga, used mostly for military and oil company flights, has been opened to limited international flights since the clashes erupted and Tripoli International Airport was closed.
At least nine people were killed and 19 wounded overnight in Benghazi, mostly civilians, in heavy clashes as government forces tried to oust Islamist militants holed up in Libya's eastern port city, medical sources said on Thursday.
Most gas stations in Tripoli have closed since the fighting erupted over the airport. Hundreds of cars have been left for days in long lines at different stations waiting for fuel.
Two main rival militias in Tripoli have exchanged fire with Grad rockets, shells and anti-aircraft cannons for control of the country's main airport for nearly two weeks, damaging aircraft there and shutting down most international flights.
Turkish Foreign Minister Ahmet Davutoglu said on Thursday that Istanbul may evacuate its embassy in Tripoli, a day after his ministry advised all Turkish citizens to leave the North African country due to the worsening security situation.
OIL OUTPUT HIT
The fighting has also taken a toll on Libya's fragile oil industry. The significant El-Feel oilfield has reduced production due to the clashes and total output slid around 20 percent to 450,000 barrels per day (bpd) on Monday.
A spokesman for the state-run NOC said on Thursday production had risen to 500,000 bpd, but added there was still no progress on reopening the Brega oil port after a deal with protesters to end a blockade there.
Reopening Brega would boost crude output by bringing the stalled Sirte oil operations back into production.
The OPEC oil producer's petroleum industry has been a prime target for blockades by militias and other armed groups seeking to pressure the government for financial or political gain.
Libya's Western partners fear the country is becoming increasingly polarised between two main factions of competing militia brigades and their political allies.
One side is grouped around the western town of Zintan and their Tripoli allies who are loosely tied to the National Forces Alliance political movement in the parliament.
The second faction centres on the more Islamist-leaning Misrata brigades and allied militias who side with the Justice and Construction Party, a wing of the Muslim Brotherhood.
Zintan fighters have controlled Tripoli's main airport since the fall of the capital in 2011. They have repeatedly clashed with rivals in Tripoli, but this week's battles were the most sustained since Gaddafi's overthrow.
Western powers hope the formation of a new parliament in August after a June election will open the way for the factions to forge a political settlement over a new government.
The previous parliament, known as the General National Congress, was caught in a deadlock between Islamist and nationalist factions and was blamed by many Libyans for the lack of progress toward political stability and democracy. (Additional reporting by Ahmed Elumami, Feras Bosalum,; Writing by Patrick Markey,; Editing by Gareth Jones and G Crosse)
Our Standards: The Thomson Reuters Trust Principles.