BENIN CITY, Nigeria — It had been 10 hours since he left Libyan shores, and Desmond Isaac was so close to Italy he felt like he could almost see it. Then, a Libyan Coast Guard vessel appeared and Mr. Isaac, a 32-year-old Nigerian who had sold all of his possessions to make it to Europe, was plucked from his rubber dinghy and taken back to the continent he thought he had escaped.

Mr. Isaac, whom Libyan officials detained, is one of around 7,000 Nigerian migrants the International Organization for Migration has returned home on chartered flights from Libya since January 2017.

Efforts have intensified to bring more migrants home from Libya, an increasingly dangerous transit point many Africans pass through on their way to Europe. A recent CNN video showed what was described as sub-Saharan Africans being sold as slaves in auctions there.

The migration organization is planning to fly home a further 20,000 migrants over the next few weeks, many of them Nigerian. And Nigeria has announced that it will begin arranging its own returns.