Dadaab is home to some 256,000 people, the vast majority of them Somalis who fled across the border.
PIC: An overview of the part of the eastern sector of the IFO-2 camp in the sprawling Dadaab refugee camp, north of the Kenyan capital Nairobi. (AFP)
Kenya's High Court on Thursday blocked the government's decision to close the Dadaab refugee camp -- the world's largest -- and force Somali refugees to return home.
Judge John Mativo ruled that the plan to shut down the camp was unconstitutional, violated Kenya's international obligations and amounted to persecution of refugees.
Dadaab is home to some 256,000 people, the vast majority of them Somalis who fled across the border following the outbreak of civil war in 1991.
The government unilaterally decided to close the camp in May last year, saying it was a terrorist training ground for Shabaab Islamist militants.
It repeatedly stated its intention to deport all Somali refugees despite a barrage of objections from rights groups and relief organisations.
Mativo ruled that "the government decision specifically targeting Somali refugees is an act of group persecution, illegal, discriminatory and therefore unconstitutional".
The shutdown was ordered without proper consultation of people affected by the decision, in violation of the constitutional right to fair legal proceedings, he said in his ruling.
"Hence the said decision is null and void," he said.
The collective repatriation of Dadaab refugees to the borders of their country of origin against their will violated the 1951 United Nations Convention on refugees, he added.
The judge's ruling also blocks the government's decision to disband Kenya's Department for Refugee Affairs.
A source in the state prosecutor's office told AFP that the government would "very likely" appeal the ruling in the coming days.
The decision followed a case filed by the Kenya National Commission on Human Rights and rights group Kituo Cha Sheria challenging the legality of the shutdown.
Amnesty International's East Africa chief Muthoni Wanyeki hailed it as "historic".
"Today is a historic day for more than a quarter of a million refugees who were at risk of being forcefully returned to Somalia, where they would have been at serious risk of human rights abuses," Wanyeki said.
"This ruling reaffirms Kenya's constitutional and international legal obligation to protect people who seek safety from harm and persecution."
Somali boys fetch water from a puddle that formed after rain at the IFO-2 complex of the sprawling Dadaab refugee complex
The government caught refugees, aid groups, the United Nations and Kenya's Western partners offguard last May when it announced plans to shut down the huge camp near the border, citing security concerns.
Since sending troops into neighbouring Somalia in 2011, Kenya has come under repeated attack from Al-Qaeda-linked Shabaab militants.
The government has presented Dadaab as a security risk, saying Somali Islamists inside the camp planned the Shabaab attacks at Nairobi's Westgate shopping mall in 2013 and the Garissa university attack in 2015, though it has not provided evidence.
Authorities initially planned to close Dadaab at the end of November, but delayed the shutdown until May 2017 at the request of the UN refugee agency and against a backdrop of growing accusations of forced refugee returns to Somalia.
The sprawling Dadaab complex near the border with Somalia currently houses some 256,000 people compared to 320,000 in mid 2016.
The UN High Commissioner for Refugees says the numbers have dwindled thanks to voluntary repatriations as well as resettlement in the Kakuma camp in northwest Kenya.
In September, Human Rights Watch warned in a report that the repatriation of Somalis from the camp violated international standards and that refugees were returning home involuntarily only to face persecution and hunger. The Kenyan government dismissed the report.