TRIPOLI (Reuters) - Armed groups aligned with a U.N.-backed government in Tripoli took over a compound occupied by a rival prime minister early on Wednesday, after heavy fighting that spread to several parts of the Libyan capital.

A damaged vehicle is seen after armed groups aligned with a U.N.-backed government took over a compound occupied by a self-declared rival prime minister in heavy fighting, in Tripoli, Libya, March 15, 2017. REUTERS/Hani Amara

The offices of a television station sympathetic to the self-declared National Salvation Government were burned down in the clashes and the channel went off air. A hospital was also hit.

The fighting apparently was triggered on Monday by a dispute over control of a bank in the Hay al-Andalus neighborhood, then escalated into power struggles between rival groups from Tripoli and the port city of Misrata and between groups aligned with the U.N.-sponsored Government of National Accord (GNA) and their opponents.

Tripoli is controlled by a patchwork of armed groups that have built local fiefdoms and vied for power since Libya’s 2011 uprising. Residents said the latest clashes were partly driven by anger with groups from Misrata, which have bolstered their position in Tripoli since 2014 when they helped bring the National Salvation Government to power.

Gun fights continued for much of Tuesday in western Tripoli before spreading to southern neighborhoods after sunset. Tanks and other heavy weapons were deployed on the streets.

By Wednesday, guards belonging to the Central Security of Abu Salim brigade, which is aligned with the GNA, were posted outside the Rixos hotel complex, where the head of the National Salvation Government, Khalifa Ghwell, had established a base.

A Reuters reporter said a gate to the complex had been demolished, some buildings were damaged or burned, and the brigade’s fighters had secured surrounding roads. A loud blast was heard early on Wednesday afternoon near the complex, and at least two Abu Salim brigade members were driven away for medical treatment.

Slideshow ( 6 images )

One building was being used as a field hospital and officials from Tripoli’s criminal investigations department were removing computers and documents. A video posted by the Abu Salim brigade showed its leader, Abdulghani Kikli, making a short victory speech outside the Rixos complex surrounded by fighters dressed in casual clothes and waving guns.

Ghwell suffered a minor injury as he tried to leave the Rixos at dawn, one of his aides told local website Afrigatenews.

The self-declared prime minister was quoted by the website as saying: “Our National Salvation Government withdrew from its offices in Tripoli to stop the bloodshed.”

At least three people were killed and five injured in the clashes, local authorities said. A 14-year-old girl was killed when a residential building in central Tripoli was hit, according to relatives.

Office and hotel buildings near Tripoli’s seafront were also hit by missiles or shelling. So was a hospital in the Abu Salim district, setting off a fire in the pediatric department.

Schools in central Tripoli were shut because of the violence.

The offices of the TV station that was taken off air, Al Nabaa, were still smoldering late on Wednesday morning. It was not clear who had carried out the attack.

Al Nabaa was also taken off air for several weeks at the end of last March when its building was attacked as the GNA’s leadership arrived in Tripoli.

Subsequently, the National Salvation Government and its armed supporters resurfaced as the GNA struggled to impose its authority. Several rounds of heavier clashes have broken out between groups that support the GNA and those that oppose it.

Tripoli has been suffering an acute liquidity crisis and banks are often the flashpoints for violence. Last week, the headquarters of Aman bank were gutted by fire after fighting broke out outside the building.