Israeli Prime Minister Benjamin Netanyahu said on Monday he was suspending a plan to send thousands of migrants to three Western countries, putting the brakes on a decision he had announced only hours earlier.

Under the plan, made with the United Nations Refugee Agency, Israel was to send at least 16,250 African migrants to Canada, Italy and Germany.

The plan allowed for thousands of other African migrants to stay in Israel, but Netanyahu backtracked saying he would speak with residents of south Tel Aviv, where many of the migrants live.

In February, Israel started handing out notices to 20,000 male African migrants giving them two months to leave the country or risk being thrown in jail.

There are approximately 37,000 illegal immigrants in Israel, the majority from Eritrea or Sudan, according to the Population and Immigration Authority.

MONEY AND AN AIR TICKET

According to the now botched arrangement, the Israeli government offered migrants, most of them from Sudan and Eritrea, $3,500 and a plane ticket to what it says is a safe destination. At earlier immigration hearings, migrants were told they could choose to go to Rwanda or Uganda.

But rights groups advocating on their behalf say that many fled abuse and war and that their expulsion, even to a different country in Africa, would endanger them further.

The groups had challenged the deportation plan in Israel’s High Court, which on March 15 issued a temporary order that froze its implementation.

Netanyahu said the UNHCR had agreed to organise and fund the new plan that would take five years to implement.

The UNHCR said it would “facilitate the departure to third countries to be determined of some 16,000 Eritreans and Sudanese under various programmes, including sponsorship, resettlement, family reunion and labour migration schemes, while others will be receiving a suitable legal status in Israel.”

“The joint commitment is that ‘You take out 16,250 and we will leave 16,250 as temporary residents’. That enables the departure of a very large number of people, 6,000 in the first 18 months,” Netanyahu said at a news conference in Jerusalem.

The U.N.’s refugee agency had urged Israel to reconsider its original plan, saying migrants who have relocated to sub-Saharan Africa in the past few years were unsafe and ended up on the perilous migrant trail to Europe, some suffering abuse, torture and even dying on the way.

“This agreement will ensure that protection is provided to those who need it,” said Volker Türk, UNHCR Assistant High Commissioner for Protection, who signed the agreement on behalf of the UNHCR.

The largest community of African migrants, about 15,000, lives in south Tel Aviv, in a poor neighbourhood where shops are dotted with signs in Tigrinya and other African languages and abandoned warehouses have been converted into churches for the largely Christian Eritreans.

Naftali Bennett, leader of the Israeli far-right party Jewish Home – a key member of Netanyahu’s coalition government – said on Twitter that the agreement would encourage more people to enter the country illegally, and he called on Netanyahu to overturn it.