A divided government with ballooning defense budgets pursuing a nationalist agenda. A president responding to growing public distrust by wrapping himself in the military’s popular legitimacy. The militarization of the upper echelons of decisionmaking. This describes Egypt under President ‘Abdel-Fattah al-Sisi.

It also describes the United States under President Donald Trump.

To a Trump administration with little fidelity to institutional norms, the military—the United States’ most trusted public institution—is a tempting tool to score cheap political points. Take the recent deployment of 6,000 U.S. troops to the Mexican border. The idea evolved over the course of several of the president’s campaign rallies in the weeks before the November elections, in response to a Central American migrant caravan “invasion.”

Never mind that the group was over 1,400 kilometers from the border and traveling by foot. Or that the Posse Comitatus Act of 1878 proscribes the military from enforcing domestic laws, so that the deployment required soldiers to play a support role better suited for local National Guard units. Or that a leaked Pentagon risk assessment concluded that the caravan posed no risk to the United States. Or that the deployment cost more than $70 million.

In March, Trump floated the idea of a “space force,” in a typically stream-of-consciousness manner. Space force soon became a popular refrain at Trump’s rallies. Two months later at a White House meeting, he ordered the military to “immediately begin the process necessary to establish a space force as the sixth branch of the armed forces.” The Pentagon was taken by surprise. There was no plan for the force’s establishment and there has been little progress since.

In July 2017, Trump tweeted that “after consultation with my Generals and military experts” the United States would bar transgender people from military service. The next day, the chairman of the Joint Chiefs of Staff, General Joseph Dunford, notified his service chiefs that there would be no change in policy until formal guidance was received. (Only nine months later did Trump sign a transgender ban as recommended by Defense Secretary James Mattis, which remains unimplemented due to federal court injunctions.)

Why is this cause for concern? As Egypt’s experiences attest, a military enmeshed in politics bodes badly for stability and democracy. The Egyptian military has cultivated an image as the last line of defense against Islamic radicalism and civilian incompetence. It intervenes to change the direction of Egyptian governance, most recently in 2013 by ousting then-president Mohammed Morsi, a member of the Muslim Brotherhood.

Behind its dramatic interventions, Egypt’s military benefits from much quieter and deep-rooted influence over society, despite instances of brutal repression at the hands of security forces. By being involved in economic activities as varied as owning luxury resorts, fertilizer factories, and infrastructure projects, the military projects an appearance of organizational capacity and efficiency, in contrast to the corruption and chaos of elected politicians. And while the armed forces interfere in politics at crucial moments, they prefer to keep out of the political limelight to preserve their apolitical reputation.

Since seizing power, Sisi has surrounded himself with military advisers. He has expanded the role of the military in the economy, granting lucrative contracts and financial exemptions to military-owned firms. And it’s no surprise that pro-regime news coverage emphasizes the military’s role in state projects, such as eradicating Hepatitis C and building fish farms, to show that it is working in support of Egypt’s elected leader and a former comrade in arms.

The United States is far from a military coup. Yet there are signs of civilian-military strains in the system there as well.

Military officials have long played senior roles in the U.S. government. Generals, either on active duty or retired, served as national security advisors to presidents Ronald Reagan, George H. W. Bush, and Barack Obama. But seldom have military figures been so prominent in the upper echelons as in the Trump administration, in apparent contrast to what Trump calls the “criminal deep state.”

Mattis, the first former general to serve as defense secretary in nearly 70 years, required congressional legislation to waive the requirement that the secretary be at least seven years removed from military service. He is rightly seen as one of the last remaining adults in the Trump circus. But there are concerns that the civilian policy roles at the Pentagon are being curtailed in favor of the uniformed cohort, of which Mattis himself was a member until 2013.

Bob Woodward’s blockbuster portrayal of the Trump administration, aptly titled Fear, highlighted another aspect of the erosion of military norms. Woodward recounts an episode in which Trump ordered the assassination of Syrian dictator Bashar al-Assad in April 2017 after a chemical weapons attack on the town of Khan Sheikhoun. Mattis responded that he would work on it, but then told his aide, “we’re not going to do any of that.”

Mattis’ prudence aside, the episode is just one example of an unelected military representative choosing to actively resist the orders of an elected president, amounting to what Woodward calls an “administrative coup d’état.” Last week, former secretary of state Rex Tillerson, in his first public interview since being fired by Trump in March, noted that Trump’s orders often violated the law.

The military is one of the last bulwarks against the complete polarization of American society. A recent poll suggests that 80 percent of Americans are confident that the military acts in the best interest of the public, compared to only 32 percent regarding elected officials. So it is not surprising that politicians might be tempted to use the military to burnish their own reputations, and endow it with even more influence.

But the epaulets may be losing their luster in Trump’s eyes. In less than two years, Trump has fired three prominent generals—national security advisors Michael Flynn and H. R. McMaster, and White House chief of staff John Kelly. There are persistent rumors that Mattis could follow them.

But as Egypt’s modern history suggests, there is another risk that comes with a popular but politicized military at a moment of institutional crisis. More than two centuries ago, Edward Gibbon wrote that the emergence of the Praetorian Guard and its interventions in changing Roman emperors was “was the first symptom and cause of the decline of the Roman empire.” Today, it is no longer unthinkable to imagine Trump refusing to acknowledge the validity of the 2020 elections and senior military officers playing a leading role in resolving the constitutional crisis that ensues.