President Donald Trump is reportedly about to fire Homeland Security Secretary Kirstjen Nielsen — giving the Department of Homeland Security its fourth boss in less than two years — because she can’t stop people from trying to come to the United States just by shouting at them.

That’s an exaggeration, but only barely.

According to Nick Miroff, Josh Dawsey, and Philip Rucker of the Washington Post, Trump has decided to ask Nielsen (who was confirmed in December 2017 to replace John Kelly) for her resignation as part of his post-midterms Cabinet shakeup. Trump has reportedly been dissatisfied with her performance for a while — it’s generally accepted that the influence of Kelly, her mentor, is the biggest reason she’s kept the job as long as she has.

But Trump’s frustration with Nielsen seems to be rooted in his own failure to understand immigration policy. Immigration has been the signature issue of Trump’s presidency, but after nearly two years in office, the president doesn’t appear to understand that the US government can’t control whether people try to migrate to America — nor can it simply prevent anyone (or even prevent people without papers) from setting foot on US soil.

Nielsen spent her tenure implementing a border crackdown, and is about to get fired for not being tough enough

The standard line from White House reporting is that Trump is mad that Nielsen isn’t tough enough on immigration enforcement. But this assessment doesn’t appear to be a reflection of her policy record at DHS.

Nielsen has spent most of her tenure executing an ongoing crackdown at the US-Mexico border. Under her watch, thousands of National Guard units and active-duty military have been deployed to the border (many for no obvious purpose).

Nielsen’s DHS has made it near-impossible for people to seek asylum. Under a proclamation signed by Trump on Friday, people who enter the US between official border crossings (called points of entry) are categorically ineligible for asylum; asylum-seekers who do try to come to ports of entry, meanwhile, are forced to wait for weeks (or simply turned away) under a department policy of “metering.”

Most famously, Nielsen signed off on the “zero-tolerance” prosecution policy that resulted, in late spring and early summer, in the separation of thousands of families at the US-Mexico border without any apparent plans to reunite them. And her department continues to work on regulations that will allow them to detain families together indefinitely.

To Trump’s critics, Nielsen is so closely associated with family separation that it would be easy to assume that she’s being fired to distance Trump from what was arguably his biggest fiasco on his signature policy issue. But that isn’t what’s happening.

Trump took credit for “securing” the border at the beginning of his presidency, and now blames Nielsen for regressing to the mean

By any objective measure, Nielsen’s border policies have been harsher than those of her predecessor (and protector) John Kelly. But Trump loved Kelly’s performance as Homeland Security secretary — so much that he promoted Kelly to White House chief of staff after less than six months.

Kelly and Nielsen are still closely allied within the administration; Kelly certainly doesn’t seem to see Nielsen as impermissibly dovish on immigration. But Kelly’s defense of Nielsen hasn’t gotten Trump to trust her; if anything, it’s encouraged Trump to stop trusting Kelly.

This clearly has something to do with the byzantine personality politics of the Trump administration. But it also has something to do with immigration. Specifically, this:

During the first few months of 2017, apprehensions at the US-Mexico border plummeted from what were already historically low levels of border crossings. Trump took personal credit — and held it up as proof that all it took was a tough-talking president to secure the border once and for all.

He was half right — and he’s been bedeviled by the other half, the “once and for all” part, ever since. Because Trump decided to measure the success of his immigration policy in whether or not people were trying to enter the US at all — not in how many were being deported, or allowed to stay, or anything else — he set himself up for failure.

It really does appear that the early-2017 lull in apprehensions was a reaction to Trump taking office. But people both within and outside the government understood at the time that the absurdly quiet border of Trump’s first months wouldn’t last, because for a year — through Kelly’s tenure and the beginning of Nielsen’s — tough talk was all the Trump administration had to offer.

People (and the smuggling networks that often facilitate their migration) make decisions about whether to migrate based on what they know about the potential outcome. When all they knew about that outcome was that Trump was talking tough, it made sense to wait and see what that tough talk turned into. When it became clear that the tough talk didn’t reflect the underlying reality — people who entered the US were still allowed to stay and seek asylum — the tough talk lost its efficacy.

This wasn’t a failure of political will on John Kelly’s part. It was a belated reckoning with reality: The low-hanging fruit of deterrent immigration policies had been picked a long time ago.

US immigration law is a balance between the desire to minimize unauthorized entry into the United States and the desire to protect vulnerable people who may be fleeing harm and persecution. Both US and international law prohibit the US from refusing entry to people who are in danger of prosecution in their home countries; both US statute and court settlements offer extra due-process protections to asylum-seekers, children, and families.

Trump’s anger at Kirstjen Nielsen was really an anger with this delicate balance. For the past six months, the US has tried to do as much as it can to push policy toward enforcement over protection — with the political and legal resistance that might be expected when tough problems are met with blunt solutions.

It wasn’t enough — at least so far. The administration hasn’t yet been able to find a way to guarantee that someone who comes to the US without papers has no chance of staying. Short of that, no policy crackdown will persuade someone desperately fleeing her home country that it’s not worth it to try to come to America. And mass deterrence — fewer people getting caught by Border Patrol because fewer people want to set foot in the US without papers — is the only outcome Trump has set himself up to accept.

Whoever follows Nielsen is going to be in the same trap Nielsen was

It’s hard to divine what, specifically, Trump thinks Nielsen should have done differently — which is to say, what he’d be looking for in her successor.

As the Post article put it, the president is “believed to be looking for a replacement who will implement his policy ideas with more alacrity.” That might just mean that Nielsen has been insufficiently gung-ho in Trump’s presence. It might mean that her department took too long to turn ideas tossed out in White House meetings into policy. (While DHS has been roundly criticized, including by its own inspector general, for its implementation of “zero-tolerance” and family separation, it did work on the policy for several weeks and debate its legality before Nielsen signed off on it.)

Those sound like reasons for Trump to replace Nielsen with an immigration hawk he already likes — which is to say, with Kris Kobach.

Kobach, who just managed to lose his election for governor of Kansas to a Democrat, was under consideration for an administration job before Trump’s inauguration. (When he failed to close his folder of notes during a pre-Trump-interview photo op, the world learned he was making proposals to Trump on voter fraud.) He was co-head of Trump’s ill-fated “voter integrity” task force.

He is the very model of a hardline immigration hawk, but even Trump appears to be concerned that he can’t easily be confirmed by the Senate. (This isn’t a thing with which Trump is typically concerned, and it’s worth wondering what role South Carolina Sen. Lindsey Graham, a close Trump ally who is the incoming head of the Senate Judiciary Committee but who’s also fairly dovish on immigration, is playing in Trump’s assessment of Kobach.)

But who else could take the job? While officials inside the department are practically begging Trump to nominate someone who already has experience at DHS — preferably someone who’s already been confirmed by the Senate — Trump doesn’t appear as enthusiastic about any of the current crop of DHS appointees as he was about John Kelly and former Immigration and Customs Enforcement (ICE) head Tom Homan, who left the administration earlier this year.

And it’s really not clear that there is anyone who could implement Trump’s “ideas” to his satisfaction — because it’s not clear what “ideas” those are.

Trump appears to have set himself against Nielsen back in May, when he famously yelled at her for 15 minutes during a Cabinet meeting. Her offense? She (and then-Attorney General Jeff Sessions) had the nerve to tell him that it would be illegal for the president to simply close the US-Mexico border to literally all legal and unauthorized crossings. As I wrote at the time:

Nielsen, as well as Attorney General Jeff Sessions, apparently tried to explain to the president that the federal government is constrained in what it can do by the law, but Trump reportedly wasn’t having it. “We need to shut it down,” he yelled at Nielsen at one point, per the Post report. “We’re closed.”

Is that the “idea” the president is looking for a Homeland Security secretary to implement with more “alacrity”? It was reportedly floated again during the late-October conversations on border escalation that resulted in last week’s asylum overhaul.

It would still be an absolute disaster for trade, and for the economies of pretty much every community along the border. It would still be flatly illegal under international and US law, which make it clear that people have the right to seek protection from persecution in the US whether or not they have papers.

And it would still not work at all, because US border policy is set up to catch as many people as possible once they have entered the US, not to prevent them from setting foot on US soil at all.

It’s really not clear whether any DHS secretary — even Kris Kobach — would be willing to go along with something so cockamamie. But Trump still doesn’t appear to understand how cockamamie it is. He doesn’t appear to get that the difference between border apprehensions under Kelly and under Nielsen isn’t a matter of political will, but the interplay of complex factors — many of which aren’t even in the federal government’s control at all, and others of which aren’t something the executive branch can fix on its own.

Until the president comes down to earth on immigration, he’s not going to find a DHS secretary that satisfies his fantasy.