The revolutionary fighters-turned-jailors who run what passes for a justice system in Libya's Gharyan region say they are making the best of a bad business.

We need help from the government. We are paying for food and medicine from our own pockets, said Ayad Sager, still dressed in desert camouflage fatigues, with an AK-47 assault rifle slung around his shoulder, three months after the end of the civil war.

Sager says he and 60 of his veteran revolutionary fighters volunteer in shifts to run Guwasim prison, 50 miles (80 km) south of Tripoli, to maintain security in the absence of any real authority imposed by the interim government.

International human rights organisations and observers say the reality is infinitely darker, however. The prisons are being used as sites to wreak revenge against those who fought for former leader Muammar Gaddafi and also as bargaining chips in the struggle for who ultimately will hold power in Libya, they say.

U.N. Secretary General Ban Ki-moon first complained in November that thousands of detainees were being held in prisons run by former rebels without access to due legal process.

Since then, Amnesty International and Human Rights Watch have charged that torture of prisoners is widespread across the country.

Humanitarian group Medecins Sans Frontieres said on January 26 it had stopped its work in detention centres in Misrata because its medical staff were being asked to patch up detainees midway through torture sessions so they could go back for more abuse.

The Justice Ministry has promised to start taking control of prisons away from militias, but progress has been slow, observers say.

The issue is yet another example of the difficulties Libya's nascent government faces trying to build a democratic state and control the armed militias, who regularly clash with each other over land and personal disputes.

GRAND CEREMONIES

Ain Zara prison in Tripoli is the seventh facility to be taken over, leaving 53 still to go, the authorities say. Libyan detentions centres hold an estimated 8,500 detainees, many of them sub-Saharan Africans and men who are suspected of fighting for Gaddafi.

A grand ceremony marked the handover last week, complete with large marquee and cake and sweets for invited guests, including journalists. After the national anthem, Justice Minister Ali Humaida Ashour assured the assembled reporters more prisons from Misrata would be taken over this week.

They told us that they planned to shift control of a few prisons this week, but it has not happened, a U.N. official in Tripoli told Reuters on condition of anonymity.

The government has to take over the prisons one by one by negotiating with the people who run it. It is not uniformly or automatically done, he said.

Sager's Guwasim prison, on a desert plain at the foot of a sandstone mountain range, now capped in a thin layer of snow, holds 400 prisoners of war and illegal immigrants.

Sager says he would be happy for the government to take the prison off his hands but no one from the Justice Ministry has ever called or visited.

Some of the prisoners don't have blankets or mattresses, they sleep on steel beds, he said while walking through the prison, which under Gaddafi detained illegal immigrants from neighbouring Niger and Chad.

Sager, who spent part of his childhood in Manchester, England, while his father pursued his PhD, denied the prison was a bargaining chip as well as the allegations of torture, and invited human rights groups to visit.

We have no medical facility here, we have to take each sick prisoner to hospital, he said, walking past rows of corrugated iron buildings which house 50 inmates each.

We feed them three meals a day, we give them soap. I even give them cigarettes and let them play football, but they need clothes. Just look at the weather.

During one journalist's visit, inmates, some of them in sandals and loose shirts, were brought out to do exercise and laps of the prison grounds, but shivered violently.

We have never done this sort of exercise before. It is a show for you guys, a Nigerian inmate whispered.

One man from Niger, sitting on his bunk in a room shared with 15 other men, said the conditions were unbearable.

We only eat rice and bread, he said in hushed tones. The guards beat us.

Reuters was given full access to the prison and allowed to interview inmates in private.

MERCENARIES

Prison guards and inmates said more than 90 percent of the prison's inmates were black sub-Saharan Africans who had no Libyan visa and had been at the prison between 4 days and 5 months.

Reuters interviewed over a dozen inmates, none of whom said they had seen a lawyer.

Many of the men said they were arrested because they were black. Revolutionary fighters say Gaddafi used sub-Saharan mercenaries to fight the pro-democracy revolt here, and now black people are often treated with suspicion.

Sager denied the accusations. We are not racist. We are trying to stop illegal immigrants from reaching Europe.

Some of the inmates at Guwasim were tried in a court in nearby Gharyan, according to Sager. But many said they were arrested by fighters at road checkpoints and had never seen the inside of a courtroom or been told that they would see one.

A few miles away at a small farming house used as a barracks for the Guwasim brigade, five men from southern Libya were being processed by revolutionary fighters who suspected that they had fought for Gaddafi.

All of the men said they were from the desert cities of Sabha and Obari, both Gaddafi strongholds during the war, and that they had been held for two weeks in a single room. One said he had been a prison guard in Tripoli. None said they fought for Gaddafi.

We arrested these men at a checkpoint. We know they fought for Gaddafi and they are foreign mercenaries, said one revolutionary fighter.

Look at their Libyan ID cards. You can tell they are fake, he said, but was unable to elaborate on how he could tell.

They need to be proven innocent, he said, explaining that meant he needed to cross-check their names against lists in Tripoli of men who fought with Gaddafi.

If the prisoners are not proven innocent, the fighters said, they are given a summary trial at the barracks and sent off to Guwasim.

During the interview, one of the detainees stood up to leave the room but collapsed back onto his side, complaining of nausea.

After two weeks, the thin, frail man was still waiting to be proven innocent.

(Editing by Sonya Hepinstall)