Washington (CNN) Sooner or later, many of the President's subordinates face the same dilemma.

They can respect the law or they can work for Donald Trump. It's often just not possible to do both.

Homeland Security Secretary Kirstjen Nielsen became the latest Cabinet member to pay the price for not letting Trump do what he wants -- and on the issue he cares about more than any other -- when she was forced to resign on Sunday.

It was a case of the Trump revolution eating one of its own, since Nielsen, an immigration hardliner, was seen as insufficiently doctrinaire despite becoming the face of the zero-tolerance immigration policy that led to child separations and caused outrage last year.

But CNN reporting makes clear that Nielsen also lost her job because she ultimately came to believe that Trump's wilder impulses on immigration -- an issue that he sees as critical to his reelection in 2020 -- threatened America's security and may have run contrary to the law.

Nielsen is not the first senior Cabinet official to lose their career after coming up against Trump's vision of his own authority -- or his instinct to elevate largely unaccountable appointees, such as domestic policy adviser Stephen Miller or his son-in-law, Jared Kushner.

In their own ways, former Secretary of State Rex Tillerson, former FBI Director James Comey and even former Attorney General Jeff Sessions -- the spiritual father of much of the administration's immigration policy -- suffered a similar fate.

Unlike the President, these public servants eventually concluded that the Constitution, the rule of law and the norms of democratic governance rendered some of Trump's behavior unacceptable.

Nielsen's departure, which was accompanied by a White House sweep against her department that also accounted for the director of the Secret Service, sends a signal that Trump is ready to do whatever it takes to stem the crisis on the US-Mexico border, which is threatening to expose his vows to stem the flows of migrants from Central America as hollow.

That will be welcome news for Trump's supporters, who relish his bypassing of the Washington establishment and overwhelmingly back his hard line on immigration and warnings that the US is under siege by an invading tide of criminals.

But the President's desire to honor the faith of his base on immigration eventually made Nielsen's position untenable.

Crossing legal lines

CNN's Jake Tapper reported on a series of clashes leading up to Nielsen's ouster on Sunday that reveal a President demanding obeisance to his orders, even if they cross legal lines.

A "ranting and raving" Trump demanded the closure of the US-Mexico border at El Paso,Texas, in late March, despite being told by Nielsen it was a dangerous idea, according to an attendee at a White House meeting.

Trump has also been pushing to reinstate and escalate the separations of undocumented migrant parents and children at the border, despite the practice being outlawed by the courts and causing bipartisan and international outrage.

The newly purged Department of Homeland Security may well embark on a policy that has been discussed for months that would give migrants at the border a tough decision to make: Remain united as a family in detention or agree to be separated while the parents go through the immigration court process, a senior administration official told CNN's Jim Acosta.

The President also told border agents last week not to let any more asylum seekers into the country, forcing officials to quietly countermand his instructions after he had left the room, Tapper reported.

CNN also reported Monday that Trump is regretting his climb down on a vow to slam shut the southern border -- despite being warned that it could trigger an economic disaster for many Americans.

As the final days of Nielsen's tenure were unfolding, it was Miller, perhaps the only top political figure to the right of Trump on immigration, who engineered a sweep to topple the top leadership in Nielsen's department.

Miller is now in charge of all immigration and border-related issues, according to CNN's Abby Phillip.

His rise is just one front in a widening war between Trump's inner circle and the infrastructure of permanent government that the President has vowed to disrupt.

Trump has in recent months removed irritating checks on his power from the Defense Department and the Justice Department.

Defense Secretary James Mattis left after being surprised by Trump's shock announcement of a Syria troop withdrawal, after being seen as an "adult in the room" for much of the first two years of the President's term.

Trump's rhetorical assault on the Federal Reserve is now being stiffened with an attempt to put true believers, such as Stephen Moore and Herman Cain on its board, raising doubts about the independence of the world's most powerful central bank.

On Tuesday, another key figure in Trump's power shuffle will face scrutiny on Capitol Hill.

Democratic lawmakers are likely to question Attorney General William Barr over claims that he was appointed solely because he had written a memo to the Justice Department arguing that special counsel Robert Mueller's obstruction case was legally flawed.

In office, and once Mueller ended his investigation last month, Barr wrote to Congress to say the special counsel had not reached a conclusion on whether Trump had obstructed justice -- but that Barr and his deputy, Rod Rosenstein, had decided there was not sufficient evidence to support such a claim.

Barr has yet to release the full report so that members of Congress can make up their own minds.

'Acting' secretaries bolster Trump's power

Elsewhere in Trump's government, a Cabinet stocked with acting secretaries in key positions -- who in many cases lack relevant experience, authority or an independent power base -- seem ill prepared to resist the President.

"I sort of like 'acting,'" Trump told reporters earlier this year, not hiding the attraction of the departure of Cabinet heavyweights. "It gives me more flexibility."

The turmoil in the administration appears to be about more than Trump's effort to consolidate maximum power for himself.

Nielsen's departure, like that of other prominent figures from the Cabinet, also appeared to have been driven by a desire to eradicate any voices that the President does not want to hear.

One of the benefits enjoyed by the global dictators Trump admires so much is they do not have to put up with dissent.

In the democratic context of the US government, the President now appears to be trying to create a similar echo chamber for himself.

Chilling words with an authoritarian lineage such as staff "purge" and "unhinged" are now being uttered by officials who have spoken to CNN to describe Trump's attitude toward the government and his current mood.

According to multiple reports, Nielsen was frequently put in the position of trying to explain to the President that his radical urges on immigration were dangerous, impossible or unlawful.

In addition to CNN's reporting, The New York Times wrote that Trump used to call Nielsen in the mornings to demand actions that were "clearly illegal," such as halting all asylum claims.

Nielsen is now among other former Trump appointees who discovered that the President's radical beliefs and vision of how to wield his power come up against legal or ethical constraints.

Tillerson, for instance, said last year that he often had to stop Trump from trampling boundaries.

"And I would have to say to him, 'Mr. President I understand what you want to do, but you can't do it that way. It violates the law. It violates treaty,'" Tillerson said.

Comey testified to Congress that he felt uncomfortable when Trump tried to establish a "patronage relationship" with him in violation of the invisible wall between the presidency and the Justice Department and asked him to go easy on his former national security adviser Michael Flynn.

The President frequently railed against Sessions because Sessions followed his legal obligations and recused himself from the Russia investigation.

And Kelly said his job often involved explaining to Trump the limits of his authority under the law.