Libyan authorities have carried out an "anti-drug" operation in a rundown suburb of the capital Tripoli that resulted in arrests and the detention of hundreds of migrants.

The attorney general, in a statement, said Friday's day-long sweep targeted "properties exploited in organising illegal immigration" and in the trafficking of drugs, alcohol and firearms.

"Many perpetrators of crimes" were arrested and "hundreds of illegal immigrants transferred to shelters", the statement reads.

On Twitter, Libya's interim Prime Minister Abdulhamid Dbeibah hailed the "interior ministry heroes" who carried out the operation against drug traffickers targeting Libya's youth.

The suburb was sealed off during the raid and residents barred from leaving their homes, a witness told AFP.

Pictures on social media appeared to show foreigners being driven away in the back of pick-up trucks. Excavators later knocked down their makeshift shelters.

The Norwegian Refugee Council expressed alarm over the reported "mass arrests".

"We are hearing that more than 500 migrants, including women and children, have been rounded up, arbitrarily detained and are at risk of abuse and ill-treatment," its country director Dax Roque said in a statement.

"Migrants and refugees in Libya, particularly those without legal residency in the country, are often at risk of arbitrary detention," he said.

"Torture, sexual violence, and extortion is rampant in Libyan detention centres. We believe this latest wave of arrests is part of wider crackdown by the Libyan authorities on migrants and refugees in Libya."

The North African country, in chaos since its 2011 revolution, is one of the main departure points for tens of thousands of migrants, mainly from sub-Saharan Africa, hoping to reach Europe.

Official centres for migrants detained in Libya are riddled with corruption and violence, including sexual assault, according to the United Nations and rights groups.

Sign up to our free newsletters

Get the best updates straight to your inbox:
Please select at least one mailing list.

You can unsubscribe at any time by clicking the link in the footer of our emails. We use Mailchimp as our marketing platform. By subscribing, you acknowledge that your information will be transferred to Mailchimp for processing.