Rebecca Rossof, visiting San Francisco from Chicago, carries a sign in support of lifting the immigration ban while in front of the U.S. Circuit Court of Appeals for the 9th Circuit in California on Feb. 9. (Monica M. Davey/European Pressphoto Agency)

President Trump’s executive order suspending travel for those who hail from seven primarily Muslim countries quickly landed in the federal courts. Many decried this action as unconstitutional, and several federal judges (both Democratic and Republican appointees) ordered an immediate halt to its implementation. And on Feb. 9, the U.S. Court of Appeals for the 9th Circuit handed down a sweeping judicial ruling that halted enforcement of the ban — and the president tweeted his impatience with its skeptical questioning of his authority.

Behind this turmoil stands an important constitutional question: Is an independent judiciary good for the long-term health of the republic?

Here we briefly review the evidence, and investigate whether the judiciary can remain independent despite the highly polarized political environment in the United States.

Why is an independent judiciary important?

One reason is that a majority of any nation’s population may not always respect democratic principles. Judges are installed to protect democracy and fundamental rights, rebuking the other two branches of government if they go beyond their authority, even with a majority mandate.

Consider one of the reasons that democracies backslide into authoritarianism. After a country is rocked by economic and political shocks, citizens often seek strong leaders who promise to rescue them — and who use their populist popularity to increase their power. Threats from other countries (or in this climate, terrorism) may be one reason these populists ask a powerful leader to do what it takes to protect them. Economic threats (such as rapid, trade-induced change) can have the same result.

The problem, of course, is that strong leaders are generally forced to move slowly in democracies that favor deliberation, consensus and power diffused among many stakeholders. Those leaders may try to eliminate checks on their authority so they can take action with popular support — even if loosening those checks may put at risk freedom, liberty, civil rights and so on.

The framers of the U.S. Constitution feared the vagaries of popular opinion. Many democratic theorists point to these inclinations as a reason that judicial independence from the elected branches of government is so important — arguing that courts are mostly immune from short-term shifts of popular opinion, and that the judiciary can block the executive if it tries to grab too much power.

But is that theory correct? Yes. That’s what we found when we examined the evidence in detail, examining 163 countries (including the United States) from 1960 to 2000.

We examined these nations after they faced the two main sources of threats to democratic stability: First, slow growth and economic change, and second, threats from rival countries or other bodies. Nations that had an independent judiciary were more likely to remain democracies even when times were troubled.

Democracy did not predict the existence of an independent judiciary — the two are distinct concepts — but independent judiciaries did help prevent democracies from backsliding into authoritarianism.

When countries had had independent judiciaries for at least two years (any less and they didn’t prevent authoritarianism), they rarely succumbed to creeping authoritarianism.

In fact, independent courts were extremely important in stabilizing democracy. Often they were they only factor that made the difference between democracy and authoritarianism. The courts were more likely to prevent executive overreach and consolidation of power than other governmental institutions, most especially the legislature.

One of the reasons for the effectiveness of courts is that judges are able to justify decisions against the executive in terms related to the constitution or the rule of law. The use of legal explanations (rather than political arguments seen in legislatures) increases the likelihood of compliance with a court decision.

Courts’ ability to stay independent rests on three factors

First, public belief that courts are legitimate; second, political elites’ respect for their authority; and finally, healthy political competition within the democracy.

First, judges understand that their authority rests on the public trust. That’s why, in the United States, the Supreme Court rarely ventures too far from public opinion in its rulings. Courts’ political power comes directly from public support.

Second, judges’ authority rests just as much on political elites’ respect for their legitimacy. That may be one reason that Trump’s Supreme Court nominee Neil Gorsuch took the unusual step of saying it was “demoralizing” and “disheartening” that the president had been tweeting criticism of the 9th Circuit hearing on his immigration ban.

Third, our research has also found that the judiciary is more likely to stay independent when a nation has healthy political competition. The courts can protect leaders who are voted out of office from retribution by the new government; they also guard the rules for free and fair competition, protecting all sides. This explains why, for example, although candidate Trump pledged that if elected he would jail Hillary Clinton, he backed off after the inauguration. No political side wants to support a system that could be turned against the next political loser in any future election.

What are the threats to the U.S. judiciary’s independence?

The new administration is not well ensconced within the party system. There are few signs that the administration cares whether the parties will be able to compete freely and fairly in future elections or whether the system tilts permanently. Such an attitude breaks down the idea that courts must be protected as an insurance policy for all political sides.

Trump’s attacks on “so-called judges” attempt to undermine courts’ popular legitimacy. That has happened before, of course. President Andrew Jackson famously taunted and defied Chief Justice John Marshall when he stated, “John Marshall has made his decision; now let him enforce it!” But the Worcester decision that he referred to was handed down almost 200 years ago, at a different time in our politics — and even then, the potential crisis fizzled without a direct showdown between the branches.

Judicial independence is good for democracy. Legitimacy and support from political leaders help maintain that independence. Attacks from political elites can seriously endanger threats to a key component of long-term democracy.

Douglas M. Gibler is a professor of political science in the Institute for Social Science at the University of Alabama. He is the author of several books, including “The Territorial Peace: Borders, State Development, and International Conflict.”

Kirk A. Randazzo is a professor of political science at the University of South Carolina. He is the author of several books, including “Defenders of Liberty or Champions of Security? Federal Courts, the Hierarchy of Justice, and U.S. Foreign Policy.” Follow him on Twitter @Kirk_Randazzo.