The Israeli government informed the High Court of Justice Tuesday it had scrapped its controversial plan to deport tens of thousands of African migrants from the country, after Israeli authorities failed to cement an emigration deal with a third country.

“At this stage there is no possibility of implementing involuntary deportations to a third country. Therefore, as of April 17, 2018, [the state] has ceased to hold hearings as part of the deportation policy, and no more deportation decisions will be made at this time,” the state said.

The admission marked a dramatic setback for the government in its years-long attempts to expel the asylum-seekers, most of them from Eritrea or Sudan, and a triumph for activists who appealed to the court against the government plans.

Get The Times of Israel's Daily Edition by email and never miss our top stories Free Sign Up

The government statement said existing deportation orders were canceled and said migrants with expired temporary residency permits will be able to get their visas renewed.

The High Court has demanded the government present a deportation plan that would safely resettle the migrants in a third country, or set them free from detention.

Last week, after Prime Minister Benjamin Netanyahu’s special emissary to Uganda returned without a signed agreement after 11 days of negotiations in Kampala, the court ordered the release of 200 African migrants from the Saharonim Prison, where they had been held since refusing to leave Israel voluntarily.

Earlier in April, 58 migrants were freed from Saharonim after a similar reported deal with Rwanda fell through.

A wide coalition of critics in Israel and in the Jewish American community had called Israel’s deportation plans unethical and a stain on the country’s image as a refuge for Jewish migrants. Several mass protests against it have taken place in several Israeli cities in recent months.

The initial deportation plan, which offered each migrant $3,500 and a plane ticket to third-party countries, has been condemned by the United Nations as chaotic, poorly executed, and unsafe. Asylum seekers previously deported to Uganda and Rwanda have told the Times of Israel they faced serious danger and even imprisonment after arriving in Africa without proper documents.

The expulsion policy drew further criticism after Netanyahu last month bowed to coalition pressure and nixed his own deal with the United Nations under which roughly half of the migrants would have been resettled in the West and others absorbed in Israel.

Netanyahu called off the agreement with the UNHCR hours after it was announced on April 2, under pressure from his right-wing political allies.

Israel considers most of about 35,000 African migrants to be job seekers and says it has no legal obligation to keep them, and officials commonly refer to them as “infiltrators.” The Africans, nearly all from dictatorial Eritrea and war-torn Sudan, say they fled for their lives and face renewed danger if they return.

The Africans started moving toward Israel in 2005 after neighboring Egypt violently quashed a refugee demonstration and word spread of safety and job opportunities in Israel. Tens of thousands crossed the porous desert border before Israel completed a barrier in 2012 that stopped the influx.

Israel has struggled with what to do with those already in the country, alternating between plans to jail and deport them and allowing them to work in menial jobs.

Thousands are concentrated in poor neighborhoods in south Tel Aviv, an area that has become known as “Little Africa.” Their presence has sparked tensions with working-class Jewish residents, who have complained of rising crime and pressed the government to take action.