It’s hard to understand what’s going on at the Department of Homeland Security right now—and that should be deeply unsettling.

President Donald Trump is in the midst of a purge of the department’s senior leadership. On Friday, he abruptly withdrew the nomination of Ronald Vitiello to lead Immigration and Customs Enforcement. On Sunday, he forced out Secretary Kirstjen Nielsen. On Monday, it was Secret Service Director Tex Alles on the chopping block. On Tuesday, Trump fired Claire Grady, the undersecretary of management and a defense-procurement expert. Lee Francis Cissna, the director of Citizenship and Immigration Services, and DHS General Counsel John Mitnick are reportedly in jeopardy as well.

It’s unclear why the purge is under way, though it appears to be a mix of policy and personal pique. Trump is upset about the continued failures of his attempts to deter illegal immigration, and is reportedly considering new policies, such as reimposing family separations, that the existing leadership views as illegal or counterproductive. The president is also reportedly skeptical of DHS leadership because many of its members were hired by former Secretary John Kelly, who became the White House chief of staff but left in December after clashing with Trump.

But if the causes are unclear, the likely consequences are not. All of these moves underscore Trump’s vision of DHS as an immigration-focused organization. But DHS has a sweeping remit—including not only border and immigration agencies, but also FEMA, the Secret Service, TSA, and the Coast Guard—and neglecting its other important responsibilities to focus solely on immigration entails a major risk to the country.

The danger of treating DHS as a single-issue agency was dramatically illustrated during the George W. Bush administration, when an excessive focus on its counterterror role helped produce the federal government’s botched handling of Hurricane Katrina in 2005.

Trump has long made clear that immigration is a top priority, from his 2016 campaign to the government shutdown he forced in December, and his recent moves show how that applies to DHS. For example, Trump announced that he was elevating Kevin McAleenan, the commissioner of Customs and Border Protection, to replace Nielsen on an acting basis. It’s not clear that Trump had thought through the implications—under the law, Nielsen should have been succeeded by Grady. So the White House scrambled to fix the mess the president had created, delaying Nielsen’s formal departure for long enough to first fire Grady, in order to clear the way for McAleenan. Trump’s eagerness to elevate a border-focused official over a defense-focused one shows where his priorities are.

On Tuesday, Mark Krikorian of the Center for Immigration Studies, which has influenced the administration’s approach, argued on NPR’s Morning Edition that Nielsen was unfit to lead the department because her background is not in immigration.

“This job was not for her. She was in over her head,” Krikorian said. “She’s a cybersecurity person, and that she knows. And DHS does deal with issues like that. But the most pressing issues that DHS has been dealing with are obviously immigration-related issues, and she did not appreciate the urgency of this.”

But that’s begging the question. Trump certainly believes that the most pressing issues for DHS are immigration-related, but the department deals with a range of other issues—including natural disasters, terrorism prevention, and cybersecurity—that are inarguably important to the nation.

When DHS was hastily established after the September 11 attacks, it swallowed up a variety of agencies and functions from across the government. But the department was largely focused on preventing terrorism, and especially Islamist terrorism. In a way, that worked: There were no major Islamist terrorist attacks on American soil in the years that followed. But Hurricane Katrina showed the dangers of this single-minded focus. Departments that were not central to the core terrorism focus became marginalized and forgotten, and the federal government’s handling of the hurricane was a man-made disaster.

In the wake of the flood, DHS pivoted its priorities to allow it to better respond to the full range of threats under its purview. (The universal acclaim for Obama’s FEMA, led by Craig Fugate, is one example of how that worked well.) But Trump is not interested in anything other than immigration.

“What you’re seeing is the second pivot, where Trump views it solely as a border-enforcement agency,” Juliette Kayyem, who served as an assistant secretary of homeland security during the Obama administration, told me recently. “It means that all these other things—climate change, terrorism, election security—all of those things become irrelevant next to the border enforcement and wall. We’re like we were after 9/11, when all we focused on was stopping 19 guys from getting on four airplanes.”

The risk of neglect isn’t hypothetical. FEMA is already troubled. Administrator Brock Long resigned in February amid questions about his use of government cars and also extensive criticism of his agency’s response to disasters, particularly Hurricane Maria, one of the worst natural disasters in American history. Also in February, The Daily Beast reported that DHS had dramatically shrunk two task forces dedicated to protecting elections from foreign interference—despite obvious threats to elections, including the evidence of Russian meddling in 2016 uncovered by Special Counsel Robert Mueller.

Trump’s relentless focus on immigration at DHS carries a political cost, too. Ironically, Nielsen, the bureaucrat, was more attuned to this than Trump, the politician. She reportedly warned the president against shutting down the port of El Paso, Texas, because the economic fallout would be damaging to Governor Greg Abbott, a close ally of the administration. Trump’s plans for a further purge are angering key Republican allies such as Senator Chuck Grassley, who has an existing relationship with some DHS officials.

But it’s the risk to the nation, in cybersecurity, disaster preparedness, and public safety, that is the biggest problem with a myopically immigration-focused DHS. It may be, as Matt Ford has written, that DHS is simply so unwieldy that it is unworkable as an agency. In the immediate future, however, breaking up DHS seems politically unlikely. As long as DHS exists in its current form, it can only guarantee the security of the homeland if it’s focused on the panoply of threats, rather than a single, politically exacerbated one.