TRIPOLI (Reuters) - Eastern-based forces battled troops loyal to the Tripoli government in the outskirts of Libya’s capital on Wednesday as thousands of residents fled the fighting.

The Libyan National Army (LNA) forces of eastern commander Khalifa Haftar held positions in the suburbs about 11 km (7 miles) south of the city center. Steel shipping containers, sand barriers and pickups with mounted machine-guns blocked their way into the capital.

Residents reported LNA planes buzzing Tripoli as anti-aircraft guns fired at them. On the ground, Haftar’s forces were fighting forces aligned with Prime Minister Fayez al-Serraj at the former international airport and in the district of Ain Zara, witnesses said.

A Reuters reporter in downtown Tripoli could hear gunfire and explosions, which continued into late afternoon.

The United Nations said at least 4,500 Tripoli residents had been displaced, most moving away from homes in conflict areas to safer districts. Many more were trapped, it said.

The LNA forces moved out of their stronghold in eastern Libya to take the sparsely-populated but oil-rich south earlier this year, before heading a week ago toward Tripoli, where the internationally-recognized government sits.

Libya has been divided and anarchic since the 2011 toppling of strongman Muammar Gaddafi, who had ruled for more than four decades before falling in a Western-backed popular uprising.

Since then, political and armed factions have vied for power and control of the North African country’s oil wealth. After a battle for Tripoli in 2014, the country split into rival eastern and western administrations linked to shifting military alliances.

Slideshow ( 10 images )

U.N. EFFORTS

The United Nations, which wants to bring both sides together to plan an election and a way out of the chaos, has appealed for a ceasefire.

The U.N. Security Council met behind closed doors on Wednesday with Secretary-General Antonio Guterres, who said there was still time for a ceasefire “to avoid the worst, which would be a dramatic, bloody battle for Tripoli.”

“We have a very dangerous situation and it is clear that we absolutely need to stop it,” Guterres told reporters after the meeting. Summarizing the council discussion, German U.N. Ambassador Christoph Heusgen, the current president of the 15-member body, said others echoed Guterres’ call for a ceasefire.

As the fighting rumbled on, U.N. Libya envoy Ghassan Salame met Serraj and the head of a Tripoli-based assembly opposed to Haftar to discuss the situation, his office said.

Haftar’s forces published on Facebook a video purporting to show their seizure of a government base in the Aziziya district of southern Tripoli. The images, which could not be verified, showed a vehicle on fire and soldiers firing in the air, shouting “Allahu Akbar!”, or “God is greatest” in Arabic.

The U.N. humanitarian agency OCHA said it was extremely concerned about the “disproportionate and indiscriminate use” of explosive weapons in densely-populated areas.

Half a million children were at risk, it estimated.

As well as the humanitarian consequences, renewed conflict in Libya threatens to disrupt oil supplies, increase migration across the Mediterranean to Europe, scupper the U.N. peace plan, and encourage Islamist militants to exploit the chaos.

Slideshow ( 10 images )

Islamic State killed three people in a remote desert town under LNA control two days ago.

In Tripoli, nearly 50 people have died, mainly combatants but also some civilians including two doctors, according to latest U.N. casualty estimates.

Several thousand migrants, detained after trying to use Libya as a staging point for crossing the Mediterranean to Europe, have also been caught up in the crisis.

REFUGEES IN DANGER

The U.N. refugee agency UNHCR said on Tuesday it had relocated more than 150 of them - among several thousand in total - from one detention center in south Tripoli to a facility of its own in a safe zone.

One official at that detention center said he had flung open the doors on Wednesday and released another 150 migrants for their own safety due to the proximity of clashes.

The United Nations, United States and European Union have appealed for a ceasefire, a return to the U.N. peace plan, and a halt to Haftar’s push.

Instead, Haftar was moving men and equipment from southern and eastern Libya to a forward base at Gharyan, south of Tripoli, according to a foreign diplomatic source observing the deployments.

Opponents have cast Haftar as a would-be dictator in the mold of Gaddafi, though he projects himself as a champion against extremism, striving to restore order.

Haftar was among the officers who helped Gaddafi rise to power in 1969, but fell out with him during a war with Chad in the 1980s. He was taken prisoner by the Chadians, rescued by the CIA and lived for about 20 years in Virginia before returning in 2011 to join other rebels in the uprising against Gaddafi.

Despite the conflict’s flare-up, normal life was just about continuing in Tripoli, a city of roughly 1.2 million people, though residents said prices were rising and businesses closing earlier than usual.

“I don’t care who wins or loses, I just want to survive with my family,” said a teacher in Tripoli who hoped to get out.

GRAPHIC-Offensive on Tripoli - tmsnrt.rs/2WTRAvU