A high Israeli court has condemned the government's policy of detaining illegal African migrants captured in the Negev Desert, ordering that a detention facility be closed within three months and banning new detentions for a year.

Monday's ruling by the High Court of Justice sets the stage for a constitutional showdown between the country's executive and judicial branches.

It's the second time in a year the court ordered authorities to desist from detaining African migrants. The government says the detentions are meant to encourage migrants to return to their home countries.

In a 7-2 vote, the court ordered the Holot detention center in the Negev to be closed within 90 days.

Since 2006 some 50,000 Eritreans and Sudanese have entered Israel illegally via the Sinai Desert.