“S ECRETARY OF HOMELAND SECURITY Kirstjen Nielsen will be leaving her position, and I would like to thank her for her service,” tweeted Donald Trump on the afternoon of April 7th. Ms Nielsen stepped down on April 10th, but she had been twisting in the wind for months. Though she had publicly defended Mr Trump’s immigration policies, the president thought her weak. Her departure seems to presage a harsher turn on immigration from a president who considers the issue central to his re-election strategy.

Few on the left will sympathise with Ms Nielsen. She was one of the faces of the Trump administration’s “zero tolerance” policy, under which anyone who crossed America’s border illegally was referred to the Justice Department for prosecution. That resulted in the separation of thousands of children from their parents. Identifying all the families thus sundered, said the government in a court document filed last week, could take up to two years. She also defended two policies halted, to Mr Trump’s fury, by federal courts: one that would have prevented anyone who crossed the border illegally from claiming asylum, and another that would force asylum seekers to wait in Mexico rather than America while their claims were evaluated.

She reportedly almost resigned last year, after Mr Trump publicly berated her for failing to stop illegal immigration. Then she improved her standing with the president last autumn after the Border Patrol fired tear-gas into Mexico at unarmed protesters. But the president had grown increasingly agitated in recent months as the number of border apprehensions rose (though they remain far below their levels of a decade ago).

The administration’s decision last week to withdraw the nomination of Ronald Vitiello to lead the Border Patrol, which Ms Nielsen had backed, suggested the writing was on the wall. Mr Trump said he wanted to “go in a tougher direction”. After returning from a visit to the southern border last weekend, he demanded and received Ms Nielsen’s resignation. Her departing letter sounded a Trumpian tone, blaming “Congress and the courts” for not “fixing the laws which have impeded our ability to fully secure America’s borders and which have contributed to discord in our nation’s discourse.”

Her departure—and that on April 9th of Claire Grady, the acting deputy secretary—leaves Mr Trump’s chosen successor, Kevin McAleenan, as acting homeland-security secretary. He thus becomes the sixth current interim holder of a cabinet-level position. How long he will last is unclear, as is the full scope of his power. On April 10th Mr Trump announced that “there’s only one person running [immigration policy]. You know who that is? It’s me.”

The problem is that Mr Trump seems to want to do things that American law does not allow—and among the things that reportedly soured him on Ms Nielsen were her reminders that legal constraints existed. The New York Times reported that he demanded that Ms Nielsen should stop migrants from claiming asylum, which is both illegal and impossible.

Shortly before his most recent visit to the border, the president said America needs to “get rid of the whole asylum system” and “get rid of judges”. He reportedly told border policemen to break the law and deny asylum-seekers entry to America. “Our country is full,” Mr Trump declared on April 5th at the Mexican border. “We can’t take you any more…so turn around, that’s the way it is.”

More departures from Homeland Security may soon follow, including the department’s general counsel and the head of Citizenship and Immigration Services. On April 8th Mr Trump also announced that Randolph Alles would step down as head of the Secret Service, though that may be connected to an embarrassing security breach at Mar-a-Lago, his Florida country club.

Stopping the tide of migrants completely is beyond the power of any homeland-security secretary. But it is not beyond their power to try—or at least to appear on television to be trying, and then blame Democrats and feckless judges for any failures. The president seems to like that sort of performance more than any realistic policy. Throughout his time in office, Mr Trump has preferred fighting public battles on immigration and much else to the unglamorous work of compromise and governance.

As next year’s election approaches, that attitude may become even more apparent. Immigration policy offers the sharpest possible contrast between Mr Trump and most Democrats. That helped put him in office two years ago. Ms Nielsen’s departure, and the “tougher direction” he claims to want, suggest that he is gearing up to fight the same battle again.