TRIPOLI (Reuters) - Libya’s coastguard rescued nearly 500 migrants on Tuesday at sea west of the capital Tripoli, a spokesman said, underlining the challenge of trying to slow an exodus from Africa and the Middle East.

The migrants included people from sub-Saharan countries, Egypt, Morocco and Tunisia.

“Coastguards rescued early morning today 140 illegal migrants west of Tripoli and another group of 164 migrants were rescued off Sabratha including seven women and six children,” a spokesman for Libya’s naval forces told Reuters.

Later another group of 150 were rescued off Tripoli.

Hundreds of thousands of migrants have crossed the Libyan desert and taken to flimsy boats on the Mediterranean in the hope of reaching Europe in recent years.

A plan was agreed in Paris on Monday by four European countries and three African states, including Libya, to support nations struggling to contain the flow of people.

Leaders agreed on the principle of setting up a mechanism to identify legitimate migrants fleeing war and persecution, and to use the United Nations to register them in Niger and Chad so as to prevent them from being exploited by people smugglers.

Libya has been in turmoil since an uprising six years ago overthrew former leader Muammar Gaddafi.