WASHINGTON — A “recalcitrant” bureaucracy and the difficulty in finding political appointees willing to bear the “personal cost” of implementing President Donald Trump’s immigration agenda are to blame for the flood of asylum-seekers at the Mexican border, according to the White House.

“In terms of a lot of the administration’s core priorities, a lot of them have either been moving too slowly, or been moving in the wrong direction for a while,” a senior administration official told reporters Tuesday on condition of anonymity.

The briefing came after Department of Homeland Security Secretary Kirstjen Nielsen’s abrupt departure Sunday night and was designed to explain “why DHS wasn’t working” and “the need to make some significant changes,” the official said.

The official singled out DHS’ legal office and the Citizenship and Immigration Services agency as particularly problematic. “There’s been shockingly little affirmative regulation,” the official said, such as an effort to deny benefits to both legal and illegal immigrants. “In fact, there’s been no major immigration regulation completed by DHS in the last two years and three months.”

Trump was inaugurated two years and three months ago.

The official called the current situation at the border, which is experiencing the highest number of unauthorized crossings in some 15 years, fundamentally a “court and congressionally created crisis,” but acknowledged that mistakes early in the administration have exacerbated the problem.

For example, “very few politicals were put into key positions,” the official said, referring to appointments of Trump supporters as opposed to civil service employees, which enabled workers who philosophically opposed Trump’s initiatives to drag things out as long as possible.

“The mere act of electing a Republican president doesn’t mean that suddenly every civil career employee goes to work every day and starts undoing all the things that they did for the last eight years,” the official said.

The failure to fill political appointments quickly and keep them filled was a function of the social disdain for Trump administration officials — particularly officials who have implemented his immigration policies such as the Muslim ban or the separation of families.

The official said that former Immigration and Customs Enforcement chief Tom Homan received multiple death threats, while other officials have been harassed in public.

“There’s a cost, a personal cost associated in today’s hyper-partisan environment with an increasingly vocal hard left on immigration,” the official said. “You would not be able to go out to, like, a restaurant in Washington, D.C.”

One consequence of that, the official said, has been hiring unqualified managers for important jobs: “The skill set that translates to managing a large and sometimes very recalcitrant bureaucracy is a very different skill set, sometimes, from working at a think tank or drafting messaging amendments or doing blogging.”

Another consequence was a failure early on to implement rules discouraging whole families from entering the United States, such as sending them back to Mexico or fast-tracking their removal proceedings and quickly putting them on flights back home. “All those things are vastly more operationally viable when the numbers are smaller and the deterrent effect is exponentially higher,” the official said.

Going forward, the administration needs to write and adopt more rules to discourage immigrants from coming, including one that allows for another run at a legal ruling that prohibits the detention of children for more than 20 days, the official said, as well as to push harder to change the “cultural bias” within some immigration-related agencies that favors “granting benefits.”

“Changing that administrative culture to one of protecting U.S. workers and citizens rather than seeing the applicant as the client is a shift that can be dealt with through management issues,” the official said.

But, with Nielsen gone and Customs and Border Protection Commissioner Kevin McAleenan about to take over as acting secretary, the official added, there was always the possibility of change. “Things can be rehabilitated.”