Libyan revolutionary brigades accused of torture still hold captive three quarters of detainees from the country's civil war as a lack of judicial police prevents the government from taking control of more jails, the United Nations said on Wednesday.

Up to 6,000 detainees were estimated to remain in brigade facilities, while the Ministry of Justice has taken charge of eight detention centres holding 2,382 people, Ian Martin, the U.N. special envoy for Libya, told the U.N. Security Council.

The U.N. human rights agency and aid groups have accused the brigades of torturing detainees, many of whom are sub-Saharan Africans suspected of fighting for the toppled government of Muammar Gaddafi during Libya's nine-month civil war.

Martin has urged the Ministry of Justice to accelerate the process of asserting government control over detention centres, but said progress continues to be complicated by insufficient numbers of judicial police, who are police working for the ministry.

We will continue to work closely with the authorities and to encourage them to ensure that inspections of known facilities are undertaken, that secret locations are identified and brought under government control, and that abuses are investigated, Martin said.

Accusations of the mistreatment and disappearances of suspected Gaddafi loyalists are embarrassing for Libya's ruling National Transitional Council, which has vowed to make a break with practices under Gaddafi and respect human rights.

It is also awkward for the Western powers which backed the anti-Gaddafi rebellion and helped install Libya's new leaders.

Gaddafi's 42-year rule collapsed when his forces fled Tripoli in August, and the last of the fighting in Libya ended in October when he was captured and killed by rebels.

Libyan Ambassador Abdurrahman Mohamed Shalgham told the U.N. Security Council that detainees held by the government, including a number of former Gaddafi ministers and senior officers, were treated well.

However, let me say that there are areas where the state has not been able to control. There is not police or courts in those areas. We cannot be responsible for all excesses everywhere, Shalgham said.

We are against them, we object to them and we hold the perpetrators of such acts responsible, he said.

Martin said that while the armed brigades lacked clear lines of command and coordination, they continued to perform important security functions often for long periods without payment.

Contrary to the impression given by some media reports, although they seek guarantees that the transformation for which they have fought is securely on track, there is little indication that they wish to perpetuate an existence outside state authority, Martin said.

Shalgham also appealed to the U.N. Security Council for Libyan funds. We need our frozen assets to be released. We are working for transparency concerning those funds, he said.

Financial sanctions by the U.N. Security Council's had frozen $170 billion in Libyan assets, but a large sum was released in December when the council lifted the sanctions on the central bank's $100 billion, mostly cash assets.

(Reporting by Michelle Nichols; Editing by Vicki Allen)