Here’s a question: Who was in charge of the implementation of Donald Trump’s executive order on Friday banning people from seven majority-Muslim countries and nearly all refugees from entering the US?

It sounds like a trick question. Reporting over the last week has made it clear that the rollout of the executive order was chaotic at every level. The secretary of the Department of Homeland Security got briefed on it only as the president was signing the order on national TV. There have been at least four distinct answers from the government on whether the policy applies to green card holders.

But in practice, there is an answer to that question: Customs and Border Protection agents implemented it themselves. Given a great deal of authority to enforce the order — with little or no training on how, precisely, to do that — and the implicit blessing of the president himself, they’ve stepped into the vacuum of authority to enforce the order as broadly and harshly as possible.

Reports are rampant of agents detaining people trying to enter the US, depriving them of food and medicine; ignoring (if not outright resisting) federal court orders to release detainees or at least grant them access to lawyers; and asking green card holders intrusive questions about their politics that could be seen as a loyalty test.

These aren’t powers that the executive order, per se, gave to CBP agents. They’re powers the Trump administration has granted them. President Trump came into office promising not only to unleash law enforcement officers who’d felt suppressed under Barack Obama, but to allow them to drive policy. We’re seeing the results.

The bureaucratic chaos of Trump’s DHS means agents are empowered to set policy

On Friday night — as the chaos of the immigration ban began to unfold at JFK — lawyers asked CBP agents who they could talk to in order to get access to one Iraqi detainee.

“Mr. President,” the CBP agents responded. “Call Mr. Trump.”

The response doesn’t imply that the agents were being given orders from the White House to detain and try to deport all immigrants who could be affected by the executive order. To the contrary, it appears that even as of Saturday morning, CBP agents had received little training or direction at all. It was a declaration of confidence: that what the agents were doing was what “Mr. Trump” would want.

That attitude isn’t surprising. Law enforcement agents and their unions have been early Trump loyalists. The unions representing agents from Border Patrol (which handles security across the border, while CBP agents handle airports and other ports of entry) and Immigration and Customs Enforcement (which deals with immigration enforcement in the interior of the US) made their first presidential endorsements to back him. (They’ve been pleased with the results: The unions released a joint statement on Saturday applauding Trump’s executive orders.)

Trump appeared on the Border Patrol union’s podcast in July. The president of the Fraternal Order of Police testified in support of Attorney General nominee Jeff Sessions’s nomination hearing.

Their support for the Trump administration isn’t about discrete policies; it’s about a broader vision of law enforcement that the policies reflect: Because rank-and-file law enforcement officers know best what it takes to keep communities safe (after all, they live it) everyone else — including the public and their own superiors — should yield to their judgment.

Before there was “Blue Lives Matter,” there was the thin blue line — the emblem of law enforcement, and a shorthand term for the internal culture of a police unit. The term comes from the military: a “thin red line” guarding against overwhelming attack. For Trump, whose presidency is built on the idea that America needs to start getting tough and stop asking questions, law enforcement officers are exactly the right heroes to elevate — and the right people to empower.

It’s a vision of policymaking made on the front lines.

Rank-and-file law enforcement has often been skeptical of managers telling them, in a top-down fashion, what decisions they ought to be making. In the early days of the Trump administration, that hasn’t been a problem. As I wrote the day Trump was inaugurated, “When the people at the bottom of the organization are making the decisions, the understaffing of top levels of the executive branch isn’t a problem; if anything, it’s a virtue.”

Releasing the text of the executive order as late as the administration did made it impossible to issue managerial guidance before it had to be enforced.

Elsewhere in the administration, this wasn’t a problem — the government employees tasked with approving immigration applications, at State and USCIS, got quick and categorical orders to stop. But when it came to enforcement, the agents were given free rein by default.

Meanwhile, the first two weeks of the Trump administration have seen the departure of the acting heads of both ICE and the US Border Patrol.

In the latter case, the head of Border Patrol resigned the day after President Trump appeared at DHS, singling out the head of the Border Patrol union (who was on his transition team) for praise “while pointedly avoiding mention” of the patrol’s commander.

It was a power struggle. And the agents won.

A lack of direction empowers field agents

The result is that field agents are able to go beyond what they’re explicitly instructed to do in the text of Trump’s executive orders. There’s nothing in the text requiring CBP agents to detain US citizens, or to deport people from Jordan, or to ask detainees insulting questions about Islam:

CBP is asking detainees if they follow sharia law, if they know anyone who has beheaded anyone. — Alex Elkins (@alexbelkins) February 2, 2017

These aren’t things agents are explicitly prohibited from doing, either. It’s a power they have the discretion to use. Without guidance from management — or the authority to hold officers accountable — there are no limits to that discretion.

That gives the rank-and-file a tremendous amount of decision-making power, which is what they’ve wanted from Trump since the beginning. Under Obama, immigration agents often complained of “low morale” because they were being prohibited from doing their jobs in the way they saw fit.

But on Saturday, in the wake of Trump signing his first immigration-themed executive orders, the Border Patrol and ICE unions reported enthusiastically that “Morale amongst our agents and officers has increased exponentially since the signing of the orders.”