Kenya's highest court has ruled against the government's planned closure of Dadaab, a sprawling camp-city near the border with Somalia that houses some of the world's most vulnerable people.The government announced last May that it planned to close Dadaab, the world's largest refugee camp. "The decision is a stinging defeat for the government of Uhuru Kenyatta, which had sent buses and airplanes to begin returning refugees to Somalia," NPR's Eyder Peralta reports from Nairobi. Some 280,000 people live in the decades-old camp.Judge John M. Mativo said in the judgment Thursday that the plans to close Dadaab and repatriate Somali refugees violate the international legal principle of non-refoulment, described in the 1951 Refugee Convention. That means states must not return a refugee to "the frontiers of territories where his life or freedom would be threatened on account of his race, religion, nationality, membership of a particular social group or political opinion."Mativo deemed the planned repatriation to Somalia "arbitrary, discriminatory and indignifying" and said the decision to close the camp was made without giving the stakeholders a say. The court judgment was posted online by the Kenya National Commission on Human Rights, which filed the case against the government.The government has argued that the camp is a hotbed for the al-Shabab militant group, which has carried out deadly attacks inside Kenya.But the judge dismissed the government's justification of a security risk coming from the camp: "It is alleged that the refugees are a threat to public security and that the refugee camps have become breeding grounds for criminal activities. No single arrest or conviction has been cited nor has it been established why a blanket condemnation should be applied to all refugees nor is it clear why the government with its capable and mighty state machinery has not been able to identify any refugees involved in crime and prosecute them instead of mounting a blanket condemnation at the risk of punishing minor children, women and innocent person."Furthermore, Mativo said the situation on the ground in Somalia remains unstable and has not sufficiently changed to justify a change in policy, contrary to the government's claims.Last May, the government also said it would close the Department of Refugee Affairs. But Mativo ruled that the government official who announced the plans did not actually have the power to do so and that the decision is therefore "null and void."The government has 30 days to appeal, and says it plans to do so. "Being a government whose cardinal responsibility is first to Kenyans, we feel this decision should be revoked," spokesman Eric Kiraithe told The Associated Press.The court judgment means "the government has to start putting in place mechanisms that will restore regular operations at the camp even though it will launch an appeal," according to the BBC.Doctors Without Borders applauded the decision in a statement, calling it a "very positive step for the lives of hundreds of thousands of refugees who have been stuck in limbo."And while the ruling is a relief to the refugees who live in Dadaab, thousands have been impacted recently by a completely different issue — President Trump's executive order on immigrants and refugees. The U.N.'s refugee agency estimates that 26,000 people in the camp have been affected by the policy change, as Eyder reports.He visited the camp last week, and spoke to The Two-Way about people he met there who have impacted by the order. Watch our videochat with Eyder here, starting at around the 4:45 mark: Copyright 2017 NPR. To see more, visit http://www.npr.org/.