DHS, run by Chad Wolf — a onetime Hill staffer turned lobbyist with no law degree, law enforcement experience or military background, who is in his eighth month as acting secretary — has become over the past two years a textbook example of what happens when legal structures built for good governance are hijacked. Now, the Trump administration has transformed federal building guards into an intimidating catchall invading army. (Ironically, most of the federal officers giving the FPS a bad name aren’t even members of the tiny service — they’re agents from U.S. Immigration and Customs Enforcement and the Border Patrol who have been granted sweeping temporary powers to help the FPS patrol federal buildings and facilities.) “The scandal isn’t what’s illegal,” as the journalist Michael Kinsley once quipped. “The scandal is what’s legal.”

The legal fudging in this episode begins at the top. Most of the key decision-makers at DHS hold their jobs because the administration has thumbed its nose at the Senate’s constitutional advise-and-consent role and has left key vacancies open for so long that officials have had to legally relinquish their “acting” title and are now referred to as “senior officials performing the duties.” Like Wolf, Deputy Secretary Ken Cuccinelli is also a temporary appointment, as is the general counsel, Chad Mizelle. The statutes that allow officials to serve in acting roles were crafted with the expectation that presidents would actually attempt to fill the jobs. But that’s not how Trump uses them — just one way his presidency has turned into a civics lesson in what’s possible if you ignore the spirit of the law and focus only on its letter.

Which is how Wolf and Cuccinelli, two men never confirmed to lead DHS, turned to a man never confirmed as general counsel to back a dubious legal interpretation that allowed them to order the largest and third-largest federal law enforcement agencies, Customs and Border Protection and ICE, into Portland using powers never intended to turn the Federal Protective Service — an agency overseen by Randolph “Tex” Alles, who was never confirmed to his post, either — into the equivalent of all-purpose federal riot police.

Now, after justifying the use of federal forces in Portland, the administration is expanding the model to Chicago and elsewhere. To execute its plan to suppress unrest — and provide striking images for Fox News — it found a statute titled “Law enforcement authority of Secretary of Homeland Security for protection of public property” (40 U.S. Code § 1315), which is normally used to empower and enlist help for the Federal Protective Service. In the course of protecting buildings, the empowered officers are allowed to investigate and make arrests for “any felony cognizable under the laws of the United States.”

The FPS was hardly meant to be America’s domestic Delta Force. It traces its roots to the first six night watchmen hired in the 1790s to guard the federal buildings in the new capital city, and it was shuffled into DHS from the government’s real estate manager, the General Services Administration, in 2003. There, it withered and its budget atrophied, even amid the surge of security spending after 9/11. After an embarrassing series of incidents in 2007 — including one in which a man died in a vacant federal complex in Kansas City, Mo., and went undiscovered by guards for three months — D.C. Del. Eleanor Holmes Norton (D), who led the congressional subcommittee overseeing federal buildings, said, “We’re seeing the near collapse of the Federal Protective Service.”

The Obama administration installed the building guards in DHS’s National Protection and Programs Directorate; then the Trump administration moved them again last year when that directorate was reorganized into the Cybersecurity and Infrastructure Security Agency. The FPS’s roughly 1,300 officers are dwarfed by more than 13,000 contractors, who provide most of the security at federal buildings across the country. The head of its own union declared the agency “the bottom of the food chain” in DHS. It hasn’t updated its Web page on its annual activities since 2013.

Yet it’s in this obscure corner of DHS that Wolf found the authority to dispatch agents and officers from ICE and the Border Patrol to the streets of Portland, against the wishes of state and local leaders. “I don’t need invitations by the state, state mayors or state governors to do our job,” Wolf said Monday. “We’re going to do that whether they like us there or not.” It’s a statement that technically is true — but goes against decades of norms and federalism traditions.

A contextual reading of the powers granted to the DHS secretary in 40 U.S. Code § 1315 makes clear the statute’s intended purpose — to allow DHS to surge law enforcement personnel to disaster zones or genuine civil unrest. It’s similar, in ways, to the Justice Department’s process of deputizing additional officers as temporary U.S. marshals during major events. (Presidents Dwight Eisenhower, John Kennedy and Lyndon Johnson used that process to deputize Border Patrol agents to protect civil rights marchers in the 1950s and 1960s, but only after careful behind-the-scenes negotiations with segregationist governors.) The Trump administration, by contrast, has employed them for run-of-the-mill political benefit. Protests have been unfolding for weeks, and Portland residents have mostly gone about their normal daily lives, but suddenly the White House has decided a federal takeover is essential.

The lawmakers who created DHS — with concerns about creeping enforcement powers in mind — were careful to constrain it. They rejected creating an all-purpose domestic security agency, equivalent to the interior ministries of countries abroad, saying the potential for abuse of civil liberties outweighed the value. Instead, DHS’s main law enforcement personnel, the Border Patrol agents and customs officers, were meant to be the federal equivalent of street cops, highly limited and narrowly focused. They were expressly denied the designation of “special agent,” which confers detective powers to workers in the FBI, Secret Service, Drug Enforcement Administration, and Bureau of Alcohol, Tobacco, Firearms and Explosives. (The line between cop and detective was so jealously guarded that DHS executives and ICE, which does have “special agents,” for years prohibited Customs and Border Protection from even investigating the misconduct of its own employees, instead insisting that such cases be turned over to them for follow-up.)

But it turns out, if you take the otherwise narrowly constrained men and women of CBP and ICE and declare that they’re helping guard statues and federal property, they suddenly become super cops, with broad powers even when off federal property. It’s a legal fig leaf, since no one really believes Trump is all that concerned with the graffiti on Portland’s Mark O. Hatfield U.S. Courthouse. But it’s enough to justify bashing protesters in the streets.

The entire episode in Portland underscores the basic lesson of the Trump presidency: Our system of government rests on a foundation of trust and respect — trust that the president will, as the Constitution requires, “take care that the laws be faithfully executed.” Congress can’t possibly write legislation and policies if the person executing and interpreting them isn’t fundamentally trustworthy and doesn’t share a commitment to American democracy.

The FBI takes its special-agent trainees to the U.S. Holocaust Memorial Museum in Washington to teach that lesson. There, they learn how the Nazi Party used German laws (and orders from national leaders) to carry out crimes against humanity. The message is simple: Just because something is legal doesn’t make it justifiable.