In a surprising about-face, Israel's government has cancelled plans to incarcerate what it terms "illegal infiltrators" from Africa or forcibly return them to the continent.
Prime Minister Benjamin Netanyahu on Monday (April 2) announced that his government had reached a last minute deal with the UN refugee agency to resettle the African migrants in Western countries.
The presence of the estimated 42,000 Africans, who hail mostly from Eritrea and Sudan, has been controversial in Israel, a country that prides itself on being a nation of immigrants and accustomed to harsh open debates.
The vitriol heaped on the Africans has been tougher than usual. Hitherto, Israel's government had taken a carrot-and-stick approach - with a strong emphasis on the latter - to rid the country of them.
On the one hand, it had offered US$3,500 (S$4,600) to each African agreeing to leave the country. The government claimed to have signed secret treaties with third countries, presumably Rwanda and Uganda, to take them. Israel's government is said to have offered Rwanda the equivalent of US$5,000 for every person it accepts, something Kigali denied vehemently.
On the other hand, every unmarried childless young African male who remained in Israel after this month was threatened with indefinite arrest. Married men, women and children were allowed to stay put, at least for the time being.
Israeli courts have harshly criticised the government for its policies, especially the fact that it insisted on keeping the treaties with the future host countries secret. That allowed deported migrants no legal recourse in case their rights were violated, a judge ruled.
In light of past experience, that appeared to have been a real danger.
Thousands of Eritreans and Ugandans who left for Rwanda were not allowed to stay there, said Ms Sigal Rozen, spokesman for the Migrant Workers' Hotline, an NGO aiding the Africans.
"We spoke to a few of them", she says. "In Kigali, representatives of the government take away all their travel documents and tell them to go to Uganda."
It was the beginning of a long odyssey, because Uganda did not accept them either. In the end, most ended up in Ethiopian refugee camps after crossing Kenya. By this time, "they have been robbed of all the money that was given to them", Ms Rozen said.
Others tried to reach Europe. Some perished on the way.
Some Israelis condemned the policy as immoral and illegal, saying it violated international law.
In an open letter to the Attorney-General, 25 leading legal experts contended that it "violates the most basic of human rights, with which all people are endowed, including the rights to life and to liberty".
Business leaders made a concerted effort to publish letters of protest in newspapers, while pilots, Holocaust survivors and Jewish organisations in North America claimed that the government's planned deportation ran afoul of Jewish values.
Israel is a signatory to the 1951 Refugee Convention but since that year it has recognised only a total of 200 refugees, although it is in the process of granting temporary residency permits to 1,100 Sudanese.
The problem of illegal migration is new to Israel.
"Between 2008 and 2012, more Africans came to Israel than to any other country in the world," said Mr Jonathan Jakubowicz, founder of the Israeli Immigration Policy Centre, a conservative NGO with the aim of expelling non-Jewish migrants.
In 2012, Mr Netanyahu vowed to stem the flow. He erected a border fence.
"More important than this fence were the policies he adopted. They have made it completely clear that the Africans have no future here," said Mr Jakubowicz.
Israel did not recognise the Africans as refugees and, devoid of a legal status, all were denied most medical and social services.
The immense pressure had the desired effect: In 2017, not a single "infiltrator" entered Israel.
But that harsh policy now seems about to change. Mr Netanyahu, in a statement, said about half the number of migrants will leave for the Western world with the help of the UN Refugee Agency, while the rest will be granted legal status, visas and eventual residency status, which will allow them to seek employment legally.