In perhaps his first major move as acting director of national intelligence, Joseph Maguire took a controversial stand in President Trump’s favor. Congress wanted to see a whistleblower report about Trump — one that would eventually lead to his impeachment — but Maguire was blocking it.

Five months later, Maguire has been fired because he was apparently insufficiently loyal to Trump.

The arc of Maguire’s stint as acting DNI has become a familiar one within the Trump administration. Cabinet and Cabinet-level officials will often strain to strike a balance between the heavy hand of the White House and their duties as the heads of their departments. Increasingly, though, it has become clear that putting yourself on the line for some of the administration’s diciest initiatives earns you very little in the way of sustained loyalty — and often proves utterly thankless.

Maguire was dismissed this week and replaced with one of Trump’s top loyalists, U.S. Ambassador to Germany Richard Grenell, after Trump balked at a briefing delivered to Congress by a senior intelligence official. The official said Russia favored Trump in the 2020 election, The Washington Post previously reported, which prompted an angry reaction from Trump and sealed Maguire’s fate.

The story was similar with Trump’s first attorney general, Jeff Sessions. Sessions was the first member of the Senate to endorse Trump in 2016 and took over the Justice Department after Trump’s inauguration. Early in his tenure, he helped Trump lay out a justification for firing FBI Director James B. Comey. He also reshaped the Justice Department to reflect Trump’s and his own more nationalistic and hard-line immigration policies.

But it wasn’t good enough. Trump forever rued Sessions’s decision to recuse himself from the Russia investigation and his reluctance to launch some of Trump’s preferred investigations. The Post reported in November 2017, as the thin ice beneath Sessions’s feet came into focus, that “Supporters and critics say the attorney general has been among the most effective of the Cabinet secretaries — implementing Trump’s conservative policy agenda even as the president publicly and privately toys with firing him over his decision to recuse himself from the Russia case.”

Sessions ultimately survived through the 2018 election, but his rift with Trump is now threatening what would otherwise have been a cakewalk back to Alabama and into his old U.S. Senate seat in the 2020 election.

Sessions also spearheaded the zero-tolerance border policy, which forced the Department of Homeland Security to take the highly controversial step of separating families at the border. The face of it all soon became then-Homeland Security Secretary Kirstjen Nielsen, who enacted it while defending it to the hilt in public and in congressional hearings. Nielsen dubiously argued that there was actually no such family-separation policy and that the administration was merely enforcing laws passed by Congress, even as she reportedly tried to fight against what the administration was doing privately.

Nielsen also made curiously Trump-y public statements about Russia’s 2016 election interference in ways that undermined her as the head of the Homeland Security Department, and she even played dumb at a hearing when asked about Trump’s “shithole countries” remark.

She, too, was forced out despite it all, thanks to a surge in border apprehensions. And following her departure, she, like Sessions, has had to strain to salvage her public image.

Her successor didn’t have it much better. Then-acting DHS secretary Kevin McAleenan soon became the holder of the family-separation bag. He also helped successfully crack down on the sudden surge in illegal border crossings and embraced Trump’s border wall. McAleenan, who served in the Obama administration, also gave the whole effort a bipartisan veneer.

As The Post’s Nick Miroff reported when McAleenan was first looking like he was on the outs, he had been instrumental in some of the most controversial episodes for the Trump administration when it comes to the U.S.-Mexico border:

Although he has clashed with some administration officials and other DHS leaders, McAleenan has embraced, implemented or crafted many of the administration’s other controversial immigration policies, measures that immigrant advocates say have endangered migrant families and shut the door to those fleeing persecution. McAleenan said he views the moves as justified in response to a record influx of families at the border that led to nearly 1 million arrests during the 2019 fiscal year that ended Monday.

For his troubles, McAleenan got dressed down while testifying to Congress, with Rep. Elijah E. Cummings (D-Md.) berating him. “What does that mean when a child is sitting in their own feces, can’t take a shower?” Cummings said. “Come on, man. What’s that about? None of us would have our children in that position. They are human beings.”

Eventually, McAleenan saw acting U.S. Citizenship and Immigration Services director Ken Cuccinelli emerge as something of a de facto administration spokesman on immigration, undermining his authority. In October, Trump announced McAleenan was out at DHS, despite some early thought he might be given the full-time nomination as secretary.

When McAleenan was on his way out, Miroff spoke with Mark Krikorian, the director of the immigration-restrictionist Center for Immigration Studies. Krikorian said that McAleenan deserved credit for “putting out the fire du jour at the border” but that it just wasn’t working.

“The DHS secretary should be somebody who is completely part of the team, and while McAleenan is not some guerrilla fighter of the resistance, he’s not really totally on board the Trump train,” Krikorian said. “That should be the case if you’re a Cabinet secretary dealing with one of the most important issues politically for the administration.”

That last part is undoubtedly true; a president is entitled to advisers and Cabinet officials who are on board with his agenda. But what we’ve seen repeatedly is that officials who maybe aren’t completely on the “Trump train” have bent over backward for him, yet they’ve seldom been rewarded for doing so, or it just becomes unsustainable because of what Trump demanded. In other words, taking extremely difficult stances to align with Trump is no ticket to any type of sustained loyalty or job security.

And that probably should be on the mind of pretty much anyone who would take over as a replacement for McAleenan, Maguire or anybody else.