A leading human rights group has called on Libya's National Transitional Council to stop militia groups from making arbitrary arrests and abusing prisoners.
Human Rights Watch said it had visited 20 detention facilities in Tripoli and interviewed 53 detainees.
"The detainees reported mistreatment in six facilities, including beatings and the use of electric shock, and some of them showed scars to support the claims. None had been brought before a judge," HRW said in a statement.
"The NTC, with the help of its international supporters, urgently needs to set up a justice system able to provide prompt judicial review of all detainees, a task that has not been given sufficiently high priority."
HRW said thousands of people had been arrested without legal review since the fall of Muammar Gaddafi's regime in late August.
Many of those arrested, it said, were dark-skinned Libyans and sub-Saharan Africans accused of having fought for Gaddafi.
"After all that Libyans suffered in Muammar Gaddafi’s jails, it is disheartening that some of the new authorities are subjecting detainees to arbitrary arrest and beatings today," Joe Stork, HRW's deputy Middle East and North Africa director, said in the statement.
"The NTC owes it to the people of Libya to show that they will institute the rule of law from the start," he said.
HRW also said that detention facilities in Tripoli were "overcrowded and undersupplied".
"The NTC leadership needs to solve this problem together with the military brigades, local authorities, the police, and justice ministry," Mr Stork said.
"Governments and international organisations supporting Libya’s transition should make a functioning criminal justice system a top priority," he said.