GENEVA (Reuters) - Armed groups in Libya are killing and torturing detainees in prisons, some nominally under government control, where thousands of civilians are being unlawfully held, the United Nations said on Tuesday.

Successive governments in Tripoli have allowed the armed groups to arrest opponents, activists, journalists and politicians, while paying the fighters salaries and providing them with equipment and uniforms, it said.

“As a result, armed groups’ power has grown unchecked and they have remained free of effective government oversight,” the U.N. human rights office and UNSMIL (U.N. Support Mission in Libya) said in a report.

“Men, women and children across Libya are arbitrarily detained or unlawfully deprived of their liberty based on their tribal or family links and perceived political affiliations.”

U.N. High Commissioner for Human Rights Zeid Ra’ad al-Hussein denounced “appalling abuses” and “the sheer horror”.

Zeid urged authorities to release people held in custody without cause and to prosecute crimes including torture, kidnapping and executions as a step toward re-establishing the rule of law.

The report said many detainees have been held without charge or trial since the 2011 revolution that overthrew former Libyan leader Muammar Gaddafi.

Disputed elections in 2014 resulted in Libya being split between competing political and military factions in the west and east of the country. Political turmoil and sporadic armed conflict have led to economic collapse, giving space to militant groups, including Islamist insurgents.

“Torture and ill-treatment are systematic in detention facilities across Libya, particularly in the initial period of detention and during interrogations,” the U.N. said.

Methods include beatings with metal bars, flogging, and electronic shocks, it said in the report based on interviews, prison visits, legal and forensic records, and photographic and video evidence.

Official prisons overseen by the justice ministry hold an estimated 6,500 inmates and thousands more are in facilities nominally under government control but run by armed groups, the report said.

The detention facility at Mitiga airbase in Tripoli is run by the Special Deterence Force (SDF) armed group, allied to the Government of National Accord, and is probably the largest in western Libya with 2,600 detainees.

“Detainees are subjected to torture, unlawful killing, denial of adequate medical treatment and poor detention conditions,” the U.N. said.

At least 37 bodies bearing signs of torture were brought to Tripoli hospitals last year, according to the report.

In the east, about 1,800 detainees are held at Kuweifiya prison, where the U.N. documented torture and inhumane conditions, including in a section run by the Libyan National Army, a coalition led by Khalifa Haftar.

Bodies of people taken by armed groups have been found on the streets and in rubbish dumps of Benghazi, many with bound limbs, marks of torture and gunshot wounds, it said.