The government will appeal a High Court ruling stopping the closure of Dadaab refugee camp.
Justice John Mativo said on Thursday that the directive by Interior CS Joseph Nkaissery and PS Karanja Kibicho was arbitrary, null and void.
He said Interior ministry officials acted in excess of their powers and the decision to send away refugees against their will is wrong.
Spokesperson Eric Kiraithe later said the government will review the ruling and "respect the rule of law".
"The key reason for closure of the camp was that it had become a launch pad for various terrorist attacks by al Shabaab. The camp has lost its humanitarian nature and become a haven for terrorism and other illegal activities," he said at a press briefing on Thursday.
In the ruling, Mativo said the government had failed to prove the claim.
But Kiraithe said the government's cardinal responsibility was to provide security for Kenyans.
"The closure of Dadaab camp has always drawn varying interest and opinions, both nationally and internationally however, the lives of Kenyans matter. It is for this reason that we shall be strongly appealing the decision by the High Court," he said.
Mativo had given the government 30 days to appeal the ruling.
The government disbanded the Department of Refugee Affairs last May and started the closure of the camp citing national security interests.
Kiraithe said 51,727 refugees had already "voluntarily" left Dadaab camp and returned to Somalia.
He said the voluntary repatriation process was being undertaken in collaboration with the Somalia government and the UN High Commission for Refugees.
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.
Somalia's Western-backed government is battling an insurgency by al Shabaab as it oversees a fragile reconstruction effort after decades of conflict. Swathes of the country do not have basic services.
But Kiraithe noted that it has continued to stabilise politically and the election of a new president on Wednesday will further the same, he added.
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.
Rights groups argued the closure 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 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.
Thank you for participating in discussions on The Star, Kenya. Note that:
- Unwarranted personal abuse and defamatory statements will be deleted.
- Strong personal criticism is acceptable if justified by facts and arguments.
- Deviation from points of discussion may lead to deletion of comments.