At least 40 migrants have drowned in a shipwreck off Tunisia as they tried to cross the Mediterranean to Italy, United Nations and Tunisian officials said.

The Tunisian coast guard had so far recovered 21 bodies, all African migrants, and rescued three people.

The dead included at least one child.

"The boat sank during a trip that started late on Thursday from Sfax... So far, the coast guard has recovered 21 bodies and the search is still continuing," Mouard Mechri, director of Tunisia's civil protection service.

The coastline near the port city of Sfax has become a major departure point for people fleeing conflict and poverty in Africa and the Middle East and seeking a better life in Europe.

Last month 39 migrants died off Sfax in a similar accident.

The UN migration agency IOM and the UN refugee agency UNHCR said in a statement: "This tragic loss of life underscores once again the need to enhance and expand State-led search and rescue operations across the Central Mediterranean."

Some 290 people have lost their lives in such shipwrecks this year, they said.