A Kenyan court said on Thursday it would be unconstitutional for the government to close a sprawling refugee camp housing mostly people who have fled unrest in neighbouring Somalia.
Nairobi has vowed to shut Dadaab, once seen as the world's largest refugee camp, because it says the complex has been used by Islamist militants from Somalia as a recruiting ground to launch a string of attacks on Kenyan soil.
But rights groups argued it would hurt Somalis fleeing violence and poverty and accused Kenya of forcibly sending people back to a war zone. The government has dismissed that allegation.
"The government's decision specifically targeting Somali refugees is an act of group persecution, illegal, discriminatory and therefore unconstitutional," High Court judge John Mativo said in a ruling.
At its peak, as Somalis fled conflict and famine in 2011, Dadaab's population swelled to about 580,000, earning it a reputation at the time as the world's largest refugee camp. Early last year, UN officials said the number had fallen to 350,000, while a Kenyan official later in the year put it at 250,000.
The government originally wanted to shut down Dadaab last November, but delayed the closure after international pressure to give residents more time to find new homes.
The court's action was welcomed by rights groups.
"The High Court sent a strong message that at least one of Kenya's branches of government is still willing to uphold refugee rights," said Laetitia Bader, Africa researcher at Human Rights Watch.
"After months of anxiety because of the camp closure deadline hanging over their heads, increasingly restricted asylum options and the recent US administration suspension of refugee resettlement, the court’s judgement offers Somali refugees a hope that they may still be have a choice other than returning to insecure and drought-ridden Somalia."
The government has 30 days to appeal, Mativo said. There was no immediate comment from the interior ministry. The government spokesman was due to hold a news conference later on Thursday to address the ruling.
Somalia's Western-backed government is battling an Islamist insurgency as it oversees a fragile reconstruction effort after decades of conflict. Swathes of the country do not have basic services.