Libya's coastguard has detained more than 400 immigrants, mostly from the Horn of Africa, in its waters in the past two days after they tried to illegally cross to Europe in small boats, Libyan officials say.

The coastguard picked up five boatloads of people. Warning shots were fired at several vessels, and 78 people were rescued from a sinking ship, Qassem Ayoub, a Libyan navy spokesman, said.

The deputy commander of naval operations, Mohammed al-Baty, said on Thursday his office received information on Tuesday that a boatload of people would attempt to journey to Italy.

"I received information two days ago indicating that there is a small boat on the sea carrying illegal immigrants wanting to go to Italy," Baty said.

Most of those taken into custody came from Somalia and Eritrea, and a handful were from Ghana and Nigeria. Some are held at a Tripoli police station and are being examined by a United Nations medical team, Baty said.

"They were 46 people from various nationalities," he said.

According to the navy spokesman more than 400 people were detained in all, who said authorities suspected some boats had managed to make their way to the other side of the Mediterranean Sea prior to the recent detentions.

Many migrants from sub-Saharan Africa head to North Africa to escape from desperate conditions in their own countries, hoping to find work there or risk the perilous journey to Europe.

The Mediterranean can be treacherous in the fall and winter months, making spring and summer the best time for small boats with ill-equipped crews to cross the sea.

Italy alone rescued 4,000 migrants from boats trying to reach European shores in early April. At that point 15,000 migrants had already arrived there by sea since the start of the year.

Since the overthrow of Muammar Gaddafi in 2011, the number of immigrants passing through Libya has risen sharply and the country's coastguard and army are ill-equipped to stem the tide.

Source: Reuters