Armed militias now rule much of Libya, Amnesty International has warned, accusing them of torturing detainees deemed loyal to the ousted regime of Muammar Gaddafi and driving entire neighbourhoods and towns into exile.

Amnesty International quoted detainees as saying, "they had been suspended in contorted positions; beaten for hours with whips, cables, plastic hoses, metal chains and bars, and wooden sticks and given electric shocks with live wires and taser-like electroshock weapons."

At least 12 detainees had died since September after torture, Amnesty said. "Their bodies were covered in bruises, wounds and cuts and some had had nails pulled off," the group said.

The report is a fresh blow to Libya's new government, the National Transitional Council, which helped lead the anti-Gaddafi uprising that broke out one year ago this week and spiraled into a brutal, eight-month civil war.

Since the war's end with the capture and killing of Gaddafi last October, the NTC has struggled to extend its control over the nation. It has largely failed to rein in the hundreds of brigades that fought in the war, many of which now run their own detention centres for those accused of links to Gaddafi's regime.

Amnesty said it visited 11 detention camps in central and western Libya in January and February, and found evidence of torture and abuse at all but one.

"Nobody is holding these militias responsible," Donatella Rovera, senior crisis response adviser at Amnesty International, said.

The UN's top human rights official, and Amnesty International, have urged Libya's government to take control of all makeshift prisons to prevent further atrocities against detainees.

"There's torture, extra judicial executions, rape of both men and women," UN High Commissioner for Human Rights Navi Pillay said on 27 January.

Some 2,400 detainees remain held in centres controlled by the new Libyan government, but the militias are holding uncounted thousands more prisoners, Amnesty said. Most are in and around Tripoli and Misrata, the coastal city that saw some of the war's most brutal fighting, it said.

The International Committee of the Red Cross reported that from March to December 2011 it had visited over 8,500 detainees in some 60 detention centres.

Amnesty International's delegation witnessed detainees being beaten and threatened with death at a detention centre in Misrata.

In a Tripoli detention centre, they found severely tortured detainees who interrogators tried to conceal, the group reported. It spoke to detainees held in and around Tripoli, Gharyan, Misrata, Sirte and Zawiya.

The humanitarian group Doctors Without Borders suspended its work in prisons in Misrata in late January because it said torture was so rampant that some detainees were brought for care only to make them fit for further interrogation and abuse.

Rovera accused the Tripoli-based national government of "a lack of political will. They're not willing to recognize the scale of the problem. It is way, way beyond individual cases. It's an irresponsible attitude," she said.

The militias were one of the keys to the rebellion that toppled Gaddafi's 42-year rule last year, but they are maintaining their independence from the National Transitional Council.

Hundreds of Libyan militias commemorated the anniversary of the anti-Gaddafi uprising this week by allying into a new unified military council.

Thousands of fighters from across western Libya held a mass parade in Tripoli on Tuesday, showing off heavy machine guns and rocket launchers and firing rifles in the air, an outburst that appeared intended as a warning to anyone who might stage attacks during the anniversary.

Some of the militia reprisals are against dark-skinned Libyans and African contract workers who the Gaddafis had brought in for jobs ranging from construction to security and riot control, leading to attacks on so-called "mercenaries" during the uprising.

"African migrants and refugees are also being targeted and revenge attacks are being carried out," Amnesty said. "Entire communities have been forcibly displaced and authorities have done nothing to investigate the abuses and hold those responsible to account."

The violence took on an ethnic twist. "It's hunting down 'the other,'" Rovera said. "They're wreaking havoc in the community."

Amnesty said that militias from Misrata "drove out the entire population of Tawargha, some 30,000 people, and looted and burned down their homes in revenge for crimes some Tawargha are accused of having committed during the conflict."

"Thousands of members of the Mashashya tribe were similarly forced out of their village by militias from Zintan, in the Nafusa Mountains. These and other communities remain displaced in makeshift camps around the country," Amnesty said.

Amnesty called for Western pressure on the Libyan government and militias.

Rovera said that from the United States to Europe, "There are a lot of countries and governments seeking contracts in Libya, so there's no shortage of contacts" that the West can use.

Europe, the US and NATO "should tell them things as they are the time for 'wait and see' has run out," Rovera said.