(CNN) President Donald Trump is in the midst of a shakeup -- " near-systematic purge " -- of leadership at the Department of Homeland Security, the umbrella agency that oversees both border protection and immigration enforcement, Trump's top priorities as President.

The agency itself was created out of a massive shakeup, while the country was still reeling from the September 11, 2001, terror attacks and when lawmakers wanted to foster better coordination to protect the country.

The new department was meant to "focus the full resources of the American government on the safety of the American people." That's how President George W. Bush put it when signed the bill creating the massive new agency in 2003. There were several mentions of border security in that speech. The word immigration did not come up.

The political winds have clearly changed. Trump is pushing the focus of DHS in a new direction even though policing immigration and borders is only one part of what DHS does today. It is the central government agency charged with keeping the country safe from natural disaster, terror attack, and guarding the perimeter of the nation.

Trump's effort to expunge the leadership at DHS could destabilize the portion of the government most responsible for safety within the country's borders.

From 22 agencies to 1 DHS

DHS has key roles in emergency and natural disaster response, counterterrorism, airplane safety, detecting nuclear weapons, coordinating cybersecurity and infrastructure security efforts, the Coast Guard, the Secret Service and the Federal Protective Service. It's a lot.

For Trump, DHS has been a focal point of his frustrations with a government he is responsible for but feels constrained by. He'd rather ignore laws protecting civil liberties of immigrants and find ways around a Congress that does not share his vision for a border wall.

Apprehensions at the southern border have increased this year, but they are down dramatically from the time when DHS was created . But given DHS has such a broad portfolio, it has been the locus of other Trump frustrations as well.

It oversees FEMA, which is at the center of the government's roles in emergency response and everyday safety, aspects of the presidency that have proven uncomfortable for Trump.

While he clearly enjoys donning his presidential windbreaker and touring disaster sites to promise federal funds, he has picked fights with local politicians over that funding and wants to withhold any more from Puerto Rico.

During the record-setting partial government shutdown, unpaid and struggling TSA workers and unpaid Coast Guard service members who fall under DHS became the faces of collateral damage over his repeated demands for border wall funding.

The agency was intentionally created to sew the country's safety systems together. But that interconnected net is also the reason that when Trump decided to partially shut the government over Congress again denying him money for his border wall, it affected such a large portion of the government.

Empty offices

There are six vacancies among DHS top leadership listed on the agency's website -- along with eight top officials working in an "acting" capacity. That doesn't include DHS Secretary Kirstjen Nielsen, who is on her way out, or Randolph "Tex" Alles, the Secret Service Director, who is on his way out, too. It also doesn't count the potential departure of a top Nielsen deputy, Claire Grady, who would have to leave in order for Trump's preferred new acting DHS head, Customs and Border Protection commissioner Kevin McAleenan to potentially be able to take over in an acting capacity.

That's a lot of open positions for one of the largest organs of the US government. More than 205,000 people work for the DHS, according to data from the Office of Personnel Management . The largest single subagency is the Transportation Security Administration, with its nearly 45,000 screeners who are the front-line face of the federal government to millions of flying Americans.

"It's creating a large amount of uncertainty at the very head of an organization -- the only organization in the US government whose primary mission is security the homeland," David Lapan, a former spokesman for DHS who worked with Nielsen and is now openly critical of Trump's actions, said on CNN Tuesday.

"If we are looking at adversaries and they are watching closely this is the exact type of situation they're looking for to exploit," he said.

Re: DHS -- "If we are looking at adversaries and they are watching closely this is the exact type of situation they're looking for to exploit" pic.twitter.com/K7XAsexiuK — Zach Wolf (@zbyronwolf) April 9, 2019

The focus of DHS senior leadership has clearly shifted in the direction of immigration enforcement. The first item listed as a priority in the department's $47.5 billion budget request for 2020 is "securing our borders." The second priority listed is " Enforcing our immigration laws ."

TSA, which is the largest employer at DHS, only gets 8% of DHS funding in the budget request. Customs and Border Protection combined with Immigration and Customs Enforcement accounts for 33% of the DHS budget. Citizenship and Immigration Services accounts for another 5%, while FEMA, the subagency with the largest single budget request, gets 31%, although that includes an additional $12 billion for disaster relief.

A response to 9/11 attacks

After the attacks on the World Trade Center, Pentagon and in Pennsylvania in 2001, lawmakers wanted to reorganize the government to foster coordination between agencies. Days after the attacks, the Bush administration had created a new office of Homeland Security and within 14 months he was signing the legislation to reformat the government.

The department also didn't live up to its initial vision as counterintelligence operations from the FBI and elsewhere were not placed under the new agency.

Looking back, it feels like the massive department was created with incredible speed, but there were complaints at the time that Bush and the administration were moving too slow because they wanted more authority to hire and fire people working at DHS and by limiting the power of federal employee unions and stripping workers in DHS of collective bargaining. Those new limitations were later thrown out by the courts.

No political appointees like the ones Trump is purging would be protected by those unions. And neither would the acting heads he's installing to run the agency without input from the Senate.

Supporters have praised the moves.

"There has been deliberate foot-dragging and I think that's why you're seeing the White House take the necessary steps to clean house at DHS and put people in, hopefully, who will quickly execute what the President orders," said Kris Kobach, a Trump supporter and immigration hard liner and former secretary of state for Kansas, on Fox News Monday.

Trump himself denied any sort of housecleaning at DHS when he spoke to reporters at the White House Tuesday and said what's going on there is nothing big. He complained about unfriendly courts and "the worst laws of any country anywhere in the world" standing in the way of his immigration policy.

He said the mission he cares about is tamping down on immigration and on people coming across the border.

"What we need - homeland security. That's what we want. There's no better term. There's no better name," he said. "We want homeland security and that's what we're going to get."