JERUSALEM — The Israeli government has scrapped a controversial plan to deport thousands of African migrants after a high-court petition filed by human rights groups challenged the plan’s validity.

The government’s announcement Tuesday that it was abandoning the effort to send the migrants to unidentified African countries — widely reported to be Rwanda and Uganda — was welcomed as a positive step by advocates for about 36,000 migrants in Israel. But the move is also likely to bring even more uncertainty to those who have no official status here.

“At this stage, the possibility of deportation to a third country is not on the agenda,” wrote the government’s legal representative in response to the petition. “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.”

Prime Minister Benjamin Netanyahu tweeted that he intends to reopen Holot, a remote detention facility in Israel’s Negev desert that had been used until recently to house mainly single, male migrants.

Members of Netanyahu’s coalition said they agreed with the decision to reopen that facility, and several said they would advance new legislation to deport the migrants, including a clause preventing the high court from challenging such a law in the future. Coalition members have demanded that the government expel all those who entered the country illegally, even though such action might contravene international conventions signed by Israel.

As Israel weighs a controversial plan to deport African asylum seekers, The Post spoke with a family who feared their son would be deported.(Quique Kierszenbaum, Joyce Lee, Jesse Mesner-Hage/The Washington Post)

“Whatever Netanyahu has in mind now to deal with this situation, it is most likely unconstitutional, and the price of implementing it will likely mean throwing Israel out of the family of democratic nations,” said Sigal Rozen, public policy director at the Hotline for Refugees and Migrants, one of the six nongovernmental organizations that filed the petition.

She said that thousands of people had started to gather outside the office in Tel Aviv that issues visas to migrants, hoping to renew their permits in the coming days.

“It’s going to be even more chaotic than it was,” Rozen said.

The issue of the African migrants — who entered Israel illegally via Egypt, some more than a decade ago — is a particularly fraught one. Most come from Eritrea and Sudan. They say they are asylum seekers, escaping human rights abuses and war in their native lands.

The Israeli government, however, considers them “infiltrators” and says the bulk of them are simply job seekers looking for a better life.

In an interview with The Washington Post in February, Interior Minister Aryeh Deri said the international conventions signed by Israel related to refugees and not to economic migrants.

Deri said Israel had struck a deal with at least two African countries willing to take in people that Israel wanted gone. He said that each migrant who left willingly would be offered $3,500 and a plane ticket to one of the countries and that those who refused to leave voluntarily would be incarcerated and then deported.

In February, the Population and Immigration Authority started issuing deportation notices and revoked the temporary visas of thousands of people.

Last month, a coalition of six human rights organizations presented a petition to the high court demanding to see the agreements Israel had signed with the third countries, identified by Israeli media and NGOs as Rwanda and Uganda. Both countries have denied having an agreement with Israel.

Then, this month, Netanyahu presented an alternative plan, an agreement with the U.N. refugee agency to send half the migrants to Western countries and resettle the rest in Israel.

But within hours he was forced to scrap that plan, too, after coming under attack from his coalition partners, who said allowing thousands of the migrants to stay in Israel was inconsistent with the government’s policies.

Netanyahu also faced a public backlash on social media. The following day, he said he would not move forward with the plan.

“We are relieved to see that other countries were not willing to participate in Israel’s plans to forcibly deport asylum seekers,” the human rights groups said in a joint statement. “We call on the state of Israel to take this opportunity to change direction and adopt a real plan that involves absorbing the 36,000 asylum seekers who have lived in Israel for 6-12 years.”