Kenya will close Dadaab refugee camp and is drawing up a timetable to send hundreds of thousands of refugees home or to other countries, the Kenyan Ministry of Interior announced Wednesday in a plan decried by aid agencies and the U.N.

“As a country we have been glad to help our neighbors and all those in need sometimes at the expense of our security,” the ministry said in a statement. “But there comes a time when we must think primarily about the security of our people. Ladies and Gentlemen, that time is now.”

The government cited “reasons of pressing national security” for the decision to shut Dadaab, which has been called the “world’s largest refugee camp” and is home to 330,000 mostly Somali refugees. It says the sprawling camp has become safe haven for terrorist organizations like al-Shabaab — a Somali-based Islamist group.

Although al-Shabaab‘s bloody campaign is focused mainly in Somalia, the al-Qaeda linked militants are responsible for violent raids into Kenya, including the 2013 assault on Nairobi’s Westgate shopping mall, which left 67 dead, and the 2015 massacre at Garissa University, which killed at least 147. Kenya suggested closing the Dadaab after that attack.

The camp was established in 1991 to receive Somalis fleeing civil war and then received a second influx in 2011 when Somalia was beset by famine and drought, according to the U.N. refugee agency (UNHCR). Its population swelled to nearly half a million before the Kenyan government signed a repatriation agreement with Somalia and the UNHCR in 2013. After years of stagnation, the Kenyan government has now earmarked $10 million and crated a task force to expedite the closure.

But the UNHCR has asked Kenya to reconsider shutting Dadaab. It warned of devastating consequences and said the actions may violate Nairobi’s international obligations to people in need of sanctuary. International aid agencies echoed this concern. Human Rights Watch said deportations would punish innocent people and may violate international and Kenyan law. And a group of non-governmental organizations signed a joint statement warning of “far reaching implications for the thousands of refugees.”

Get The Brief. Sign up to receive the top stories you need to know right now. Please enter a valid email address. Sign Up Now Check the box if you do not wish to receive promotional offers via email from TIME. You can unsubscribe at any time. By signing up you are agreeing to our Terms of Use and Privacy Policy . This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply. Thank you! For your security, we've sent a confirmation email to the address you entered. Click the link to confirm your subscription and begin receiving our newsletters. If you don't get the confirmation within 10 minutes, please check your spam folder.

Write to Mark Rivett-Carnac at mark.rivett-carnac@timeasia.com.