The migrants were rounded up during a huge crackdown in the Tripoli region during which telecommunications equipment was also seized, the official told AFP.
Hundreds of those who had been rounded up were seen sitting on the ground outside a detention centre in Tripoli, as authorities distributed food and drink.
Libya has a coastline of 1,770 kilometres (more than 1,000 miles) and has long been a stepping stone for Africans seeking a better life in Europe.
Most head for the Italian island of Lampedusa which lies some 300 kilometres (185 miles) from Libyan shores.
People smugglers, who have operated in Libya for years, have increased their lucrative trade, feeding on the political divisions and lawlessness that has gripped the country since the end of the 2011 uprising.
Libya has now two governments and parliaments vying for power and armed militias battling for its oil wealth.
The Tripoli government, which is not recognised by the international community, has stepped up arrests of illegal migrants in recent weeks.
Last Sunday, officials linked to the Tripoli government announced the arrest of 400 illegal migrants on the same day of the launch of an operation targeting people smugglers.