TRIPOLI/TUNIS (Reuters) - Fierce clashes broke out in the Libyan capital Tripoli on Monday, killing at least 20 people, shutting the airport, and damaging planes during what the government said was a failed attempt to spring militants from a nearby prison.

A man inspects a plane damaged during clashes at Mitiga airport in Tripoli, Libya, January 15, 2018. REUTERS/Ismail Zitouny

The attack triggered the heaviest fighting in Tripoli for months, undercutting claims by the internationally recognised Government of National Accord (GNA) to have largely stabilised the city. The violence also undermines GNA efforts to persuade diplomatic missions to return there.

Automatic gunfire and artillery rounds could be heard from the city centre early in the day and authorities at Mitiga airport, which operates all civilian air traffic to and from the capital, said flights had been suspended until further notice.

The airport was empty in late afternoon, when the clashes had largely died down, though pilots flew several aircraft across the capital to the international airport - closed since 2014 due to damage from earlier fighting - in an effort to protect them.

A Reuters reporter saw one Airbus A319 operated by Afriqiyah Airways sitting in a hangar at Mitiga with a hole in its roof from artillery fire.

At least four other aircraft suffered what appeared to be lesser damage from gunfire, including two jets operated by Libyan Wings and two Buraq Air Boeing 737s that the airline said it was preparing to fly out of the country for maintenance.

The fighting pitted the Special Deterrence Force (Rada), one of Tripoli’s most powerful armed groups, against a rival faction based in the city’s Tajoura neighbourhood.

Rada acts as an anti-crime and anti-terrorism unit and controls Mitiga airport and a large prison next to it. It is aligned with the GNA and is occasionally targeted by rivals whose members it has arrested.

“ENDANGERED PASSENGERS”

Rada said the airport had been attacked by men loyal to a militia leader known as Bashir ‘the Cow’ and others it had been seeking following their escape from a prison it controls elsewhere in Tripoli.

The GNA said the attack had “endangered the lives of passengers, affected aviation safety and terrorised residents”.

“This assault was aimed at freeing terrorists from Daesh (Islamic State) and al Qaeda and other organisations,” it said in a statement. The attack had been repelled, and an operation to secure the area was ongoing.

Rada posted pictures of streets around the airport, showing pick-up trucks mounted with guns, armoured vehicles and a tank.

Slideshow ( 6 images )

At least 20 people were killed in the clashes and 60 wounded, including civilians, a health ministry official said.

Mitiga is a military air base near the centre of Tripoli that began hosting civilian flights after the international airport was put out of service in 2014. In an adjacent prison, Rada says it is holding some 2,500 people, including Islamic State suspects.

Tripoli has been controlled by a patchwork of armed groups since a 2011 uprising that toppled long-time leader Muammar Gaddafi and led to the splintering of the country. There have been rival governments in Tripoli and the east since 2014, when most diplomatic missions evacuated to neighbouring Tunisia.

The Tripoli factions sometimes clash in turf battles or over killings or detentions of their members.

But there had been less open fighting in recent months after several groups including Rada aligned with the GNA, consolidated their control of large parts of the capital and ousted groups tied to a previous, Islamist-linked Tripoli government.

The United Nations is trying to pave the way for elections in Libya by the end of the year, which it hopes can help stabilise the oil-producing nation.