Between 7,000 and 8,000 migrants mostly from sub-Saharan Africa are being held in Libyan detention centres after entering the country illegally, an official say.