When the president of the United States maligns a federal judge on a medium that reaches millions of people, his action is not only inappropriate to his office, uncivil in the extreme, and a threat to national security. It is also an announcement of the president’s desire for regime change.

The refugee and immigration policy that the president is defending against the judiciary is worse than indefensible. Aside from being sloppily constructed and almost certainly illegal, it has made the problem it is meant to address worse. The executive order did not mention the actual countries from which actual terrorists have come, such as Saudi Arabia and the Russian federation.

By calling citizens of whole countries “potential terrorists”, the president has just confirmed the impression that a religion is being targeted as such. It is much more likely that its aim was to provoke an act of terror than to prevent one. If one takes place, the president will likely claim that he was right all along, and argue that repression of American residents and citizens are necessary.

The president wrote in a 4 February tweet of “bad people” and the risks they pose. The greatest national security risk is the one created by the president’s irresponsibility. By announcing a policy of total discrimination against citizens of Iraq, for example, the president insulted soldiers of an army that is fighting alongside the American one.

By hindering the arrival of people who worked alongside the American armed forces in the Middle East, he has made clear that Americans sell out their friends. Among the “bad people” are many students with much to offer the US, including a young Iranian who, having protested the Iranian regime, was pressured to emigrate. Now the country where he chose to emigrate, the US, is treating him much the same way. The moral costs of the policy, and of its reckless defense, are enormous.

But that’s not the worst of it.

The major implication of the president’s tweet is the form it takes: an attack on a federal judge. Singling out a federal judge for presidential calumny is a profound, and no doubt deliberate, assault on the two bases of constitutional rule in the US: checks and balances among the three branches of government, and the rule of law.

Americans use the word “democracy” as a shorthand to define their system. Yet democracy as Americans know it only functions when an independent judiciary monitors the executive and legislative branches. The relationship among the branches certainly changes over time, but an open attack by the executive upon the judiciary is something new – at least in the contemporary US.

The president’s tweet recalls how authoritarianism has triumphed in other places. Modern tyrants grasp that their real target are rival institutions and legality, not voting as such. They often attack the judiciary first, assuming that the legislature will go along.

Judges cannot, by the nature of their function, engage in populist media competitions. They must be protected by other judges, other institutions and popular opinion. If judges are left on their own, and the judiciary branch loses its independence, the legislative branch is next in line for humiliation and subjugation.

Legislators have more access to the public sphere than judges, but less than the president. And if the judiciary is meaningless, the legislators, too, will soon lose their power. They can pass laws. But without independent judges whose verdicts are respected, those laws will mean only what the executive says they mean.

These are not theoretical speculations, but descriptions of regime change as it is being effected throughout the western world before our eyes. The patterns in Russia, Hungary and Poland are different in significant ways, reflecting differences in the personalities of the leaders, the behavior of opposition, and concentrations of wealth.

But the larger trend is difficult to miss: when judiciaries can be tamed, parliaments make themselves meaningless. Some lawmakers may do so from conviction, others from fear. But once the rule of law vanishes into distrust and the checks become unbalanced, the regime has changed. Voting may go on, but it means less and less.

A number of Republican lawmakers have rightly criticized the president for the language of his tweet. Having done so, they might take a moment to mind these precedents. The defense of an independent judiciary is not only their obligation, it is in their best interest. An attack on a judge is an attack on the system, and in effect an attack on them.

Chiding the president is not enough. The predominant sentiment among Republican legislators today seems to be in favor of passing desired laws now and dealing directly with Trump later. This could be a trap. Six months or a year from now, when all the laws have been passed, senators and representatives may find that they are no longer able, or willing, to resist the president.

Timothy Snyder is professor of history at Yale University