JERUSALEM (Reuters) - The Israeli government said on Tuesday it had abandoned a plan to forcibly deport African migrants who entered the country illegally after failing to find a willing country to take in the migrants.

FILE PHOTO: A boy takes part in a protest against the Israeli government’s plan to deport African migrants, in Tel Aviv, Israel March 24, 2018. REUTERS/Corinna Kern/File Photo

The government had been working for months on an arrangement to expel thousands of mostly Eritrean and Sudanese men who crossed into Israel through Egypt’s Sinai desert.

“At this stage, the possibility of carrying out an unwilling deportation to a third country is not on the agenda,” the government wrote in a response to Israel’s Supreme Court, which has been examining the case.

The migrants will again be able to renew residency permits every 60 days, as they were before the deportation push, the government said.

The migrants and rights groups say they are seeking asylum and are fleeing war and persecution. The government says they are job seekers and that it has every right to protect its borders.

Despite Tuesday’s climbdown, the government said immigration authorities would still try to deport migrants voluntarily, drawing criticism from rights group Amnesty International.

Prime Minister Benjamin Netanyahu later said that after failing to reach agreement with any country to take them in, he would try to draft legislation that would allow the reopening of detention centers in Israel for the migrants.

The Supreme Court has previously struck down legislation that permits such detention and ordered the facilities shut.

“I’M THRILLED”

The government’s U-turn was welcomed by those targeted for expulsion.

“I’m thrilled. I’m speechless. I was so scared every day. If I can stay here it will be good, I’ve lived here so long - I have a job, I have Israeli friends. I am used to the place,” said Ristom Haliesilase, a 34-year-old Eritrean who lives in Tel Aviv, working as a carer for the elderly.

The fate of some 37,000 Africans in Israel has posed a moral dilemma for a state founded as a haven for Jews from persecution and a national home.

Around 4,000 migrants have left Israel for Rwanda and Uganda since 2013 under a voluntary program, but Netanyahu has come under pressure from his right-wing voter base to expel thousands more.

After pulling out of a U.N.-backed relocation plan a few weeks ago, Israel shifted efforts toward finalizing an arrangement to send the migrants against their will to Uganda.

A number of migrant rights groups then petitioned the Supreme Court to block any such policy.

Amnesty also welcomed Tuesday’s decision but criticized Israel’s plan to continue with voluntary deportations.

“... in reality there is nothing voluntary about them. Eritrean and Sudanese asylum seekers agree to them under pressure. Israel remains under the obligation not to transfer anyone to a country” where they would be unsafe, said Magdalena Mughrabi, Amnesty deputy director for the Middle East and North Africa.

Amnesty will closely monitor the deportations, it said.