The Kenyan government has announced that it plans to expel hundreds of thousands of refugees, a move that aid agencies say would violate international law and endanger many people.

For years, Kenya has threatened to shut down the Dadaab refugee camp, where hundreds of thousands of Somalis have been marooned for decades. A sea of tents and plastic shelters spread out across miles of desert near the border with Somalia, the camp has become essentially one of Kenya’s largest cities.

On Wednesday, the Kenyan government said that terrorists were using Dadaab as a hide-out.

“As a country we have been glad to help our neighbors and all those in need sometimes at the expense of our security,” the government 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.”

Kenya is home to about half a million refugees who have fled years of war and turmoil in neighboring Somalia. But Somalia is hardly at peace now; the Shabab militant group continues to rule large parts of the country, brutalizing and killing civilians.