Israel has cancelled plans to deport thousands of African migrants and asylum-seekers after reaching an agreement with the UNHCR, the U.N.’s main refugee agency.

Under the deal, Israel will send 16,250 African migrants to western countries, while thousands more will be granted temporary (five-year) residency in Israel, according to a Monday statement issued by Prime Minister Benjamin Netanyahu’s office and cited by The Jerusalem Post.

“The plan is divided into three phases over five years, at the end of which the quality of life in and around south Tel Aviv [currently home to large numbers of migrants] will significantly improve,” the statement read.

The agreement with the UNHCR, the statement added, had been approved by Israel’s attorney-general and was “consistent with international law and accepted practice”.

The UNHCR, for its part, has yet to comment on the arrangement.

Israel is currently home to some 40,000 asylum seekers, including 27,500 from Eritrea and 7,800 from Sudan, according to UNHCR figures.

Last summer, Netanyahu vowed to deport “infiltrators” from Africa -- a pledge that has since become a rallying cry amid his far-right supporters in the run-up to polls slated for next year.

Netanyahu’s government, however, has come under immense international pressure to halt its “discriminatory” treatment of African asylum-seekers following revelations that deportees would be sent to Rwanda and Uganda.

Since 2012, Israel has deported roughly 20,000 African migrants and asylum-seekers who had entered the country illegally.