African migrants in Libya are "living in constant fear", a report by UK-based Amnesty International says.
The campaign group said the North African country's record on human rights falls well short of efforts to repair its image in the world.
It documents indefinite detentions, flogging for adultery, the continued disappearance of dissidents, and the security forces' immunity from justice.
The report is partially based on a week-long visit to Libya in May 2009.
It was the first trip of its kind in five years, facilitated by the Gaddafi Foundation - run by one of the Libyan leader's sons, Saif al-Islam Gaddafi.
Analysts say he is keen to liberalise the country, once a pariah state accused of promoting terrorism to threaten Western interests but now seen as a vital source of oil and gas resources and investment opportunities.
"If Libya is to have any international credibility, the authorities must ensure that no-one is above the law and that everyone, including the most vulnerable and marginalised, is protected by the law," Hassiba Hadj Sahraoui, Amnesty's Middle East and North Africa deputy director said in a statement.
"The repression of dissent must end," she said.
"Libya's international partners cannot ignore Libya's dire human rights record at the expense of their national interests."
Amnesty's 135-page report said there had been some improvement, and the "climate of repression" of the past three decades was "subsiding gradually".
"Some Libyans are now more willing to take risks - albeit modest and within limits - to speak out about issues that affect their everyday lives," it said.
However, for African migrants and often those challenging the state directly, the situation is very different.
In recent years, Libya has been under pressure from the European Union to stop the flood of migrants from sub-Saharan Africa crossing the Mediterranean from its shores.
"Refugees, asylum-seekers and migrants, particularly from Sub-Saharan African countries, live in constant fear," it said.
"Fear of being arrested and held indefinitely in overcrowded detention centres; fear of being exploited, beaten and abused; and fear of being forcibly returned to an uncertain future where they may face persecution or torture," the report said.
The Libyan authorities' decision to expel the UNHCR from in the country earlier this month was "likely to have a severe impact on refugees and asylum-seekers", it added.
The report also showed that the death penalty continued to be used widely in Libya, with foreign nationals particularly affected.
As of May 2009 there were 506 individuals on death row, around half foreign nationals, the director general of the judicial police, Brigadier Belkacem Abdesalam Gargoum, told Amnesty.