At a Cabinet meeting last week, after being informed that the number of Central American migrants apprehended while crossing the U.S. border illegally had reached fifty thousand for the second month in a row, Donald Trump demanded answers from Kirstjen Nielsen, his Homeland Security Secretary. “How is this still happening?” he asked her. “Why don’t you have solutions?” Other Administration officials watched as the President berated Nielsen for half an hour, going on for so long that, as the Washington Post reported, “many present began fidgeting in their seats and flashing grimaces.” At one point, Jeff Sessions, the Attorney General, came to Nielsen’s defense, to no avail. Nielsen left the meeting so frustrated that, according to the Times, she contemplated resigning.

The episode made the standing of one of the least known but most consequential members of Trump’s Cabinet a matter of national news. Yet it wasn’t the first time that the President has expressed his frustration with Nielsen. Trump has been complaining about her ever since she became head of D.H.S., in December. He didn’t like that she had once served in the Bush Administration, or that Fox News personalities such as Ann Coulter and Lou Dobbs considered her an “open-borders zealot.” Nielsen also became Secretary of her department at a complicated moment. In the early months of Trump’s Presidency, illegal border crossings declined, but they began rising last year—as many analysts expected they would, owing to continued violence in Central America. Trump, though, blamed Nielsen. “She’s charged with shutting down irregular immigration which, in fact, is impossible to shut down,” one former D.H.S. official, who worked with Nielsen, told me. Part of Nielsen’s job also involved talking the President down when he floated his own ideas for curbing immigration, many of which he picked up from Fox News. This didn’t endear her to the President, either.

Trump’s antipathy toward Nielsen is shared by many Administration officials with strong views on immigration policy. Nielsen was John Kelly’s chief of staff when Kelly held the top job at D.H.S., and she became his choice to replace him when he left the agency to serve as the White House chief of staff. But beyond Kelly, she has never had other obvious allies in the White House. Nielsen had not worked on the Trump campaign, and two of her most prominent backers from the Bush Administration—Michael Chertoff, a former head of D.H.S., and Frances Townsend, a former homeland-security adviser at the White House—were part of the “Never Trump” movement. In the early days of the Administration, Kelly and Nielsen together fended off a number of Trump allies whom the White House wanted to install in key posts at D.H.S. Since John Kelly was a retired four-star general who, at the time, enjoyed good standing with the President, disgruntled immigration hard-liners were reluctant to criticize him; they directed their frustration toward Nielsen, instead. One White House official told me that it was Nielsen who “blocked” the former Milwaukee County sheriff David A. Clarke, Jr., and the Kansas Secretary of State Kris Kobach from getting positions at D.H.S., “even though the President wanted them.”

The irony is that, since becoming the D.H.S. Secretary, Nielsen has shown herself to be both an extremely tough-minded enforcer of Trump’s immigration agenda and an enthusiastic spokesperson for his Administration. Earlier this year, a number of former D.H.S. officials told me that her eagerness to promote the Administration’s arguments had begun to worry them. “You can’t be seen as the lapdog of the White House,” one of them said. “That makes the department into a political football.” More recently, another former D.H.S. official told me that Nielsen’s embrace of the President’s rhetoric on immigration had politicized the department’s broader mission. “The place is not well,” the former official said. “This is supposed to be a department charged with protecting the homeland.” While Trump was questioning Nielsen’s place in his Administration this winter and spring, she was forced to try to prove her loyalty. One current D.H.S. official told me, “Nielsen would have a meeting at the White House and then come back to department headquarters scrambling to set things in motion.” (A D.H.S. spokesperson dismissed the official as being “poorly informed” and “out of the loop.”)

The President’s obsession, last month, with a caravan of Central American migrants travelling to the U.S. to seek asylum, coincided with a string of notably forceful pronouncements by Nielsen. Even before they reached the border, she decried the migrants’ “apparent intention of entering the United States illegally.” Earlier this month, D.H.S. and the Justice Department announced a new “zero tolerance” policy at the border, vowing to prosecute all unauthorized border crossers, including asylum seekers, for entering the country illegally. One outgrowth of the policy is that parents and their children will be separated once they’re taken into custody. The Administration initially justified its stance by insisting that breaking up families would act as a deterrent, to scare away other families that might try to cross the border—an assertion that D.H.S.’s own data does not support. Despite Nielsen’s warning of a “crisis” at the border, the number of migrants apprehended there each month remains lower than it was during much of the Bush and Obama years.

This week, I spoke with an official at D.H.S. whose doubts about Nielsen are typical of her critics from within the Administration. “You have to ask yourself, why is she doing what’s she’s doing?” the official told me. “It’s not because she really wants to do it. It’s all posture.” The official—who had worked on the Trump campaign—said, “You begin to see little fissures in the immigration policy.” Trump wanted to defund sanctuary cities and to end what he calls, pejoratively, the “catch and release” of unauthorized asylum seekers while their cases play out in immigration courts. Neither goal has been realized, and while there were legal hurdles in both cases—a federal court blocked the defunding of sanctuary cities; asylum law shapes enforcement policies at the border—the official faulted Nielsen personally. The border wall was another source of contention. Republicans in Congress skimped on funding it in the omnibus bill earlier this year. “That was an insult to the President,” the official said. “And a lot of that is on Nielsen. It was up to her to convince Congress to fund all this.” (Tyler Q. Houlton, D.H.S.’s press secretary, told me that blaming Nielsen reflected "a poor to nonexistent understanding of D.H.S. policy issues and a limited and embarrassing understanding of how the executive, legislative, or judicial branches work.”)

A Crisis at the Border More coverage of the Trump Administration’s immigration policy from The New Yorker.

One former D.H.S. official told me that there is “a cabal of anti-immigration people sprinkled throughout the government. A lot of them used to work for Jeff Sessions, and they all talked.” This group disliked Nielsen, but she survived, in part, because she has had the support of John Kelly. As Kelly’s relationship with the President has lately frayed, Nielsen’s status within the Administration has suffered, too. Nevertheless, she continues to hew closely to Kelly’s positions on immigration issues. Both have championed harsh enforcement policies, while claiming, in their own defense, that D.H.S. is merely doing its duty by enforcing the immigration laws that Congress has written.

There are additional similarities in how Kelly and Nielsen have handled confrontations with Trump. D.H.S. spokespeople denied that Nielsen considered resigning last week, but the news had gotten out anyway, and some assumed Nielsen wanted it that way. Kelly, too, has reportedly threatened to resign at times when he couldn’t corral the President. For now, Nielsen’s approach seems to have worked. Trump has reportedly called her to ask her not to resign, as has Kelly. At a meeting Wednesday, the President told her, “You’re doing a good job, and it’s not an easy job.” Nielsen does have some leverage. It will be difficult, if not almost impossible, to find a replacement for her—someone who can both appease the President and get confirmed by the Senate. As the current D.H.S. official told me, “The Administration can’t get rid of Nielsen. She doesn’t even have a deputy right now to fill in for her if she leaves.”