THE RULE OF law distinguishes democracies from dictatorships. It’s based on three fundamental principles. Donald Trump is violating every one of them.

The first is that no person is above the law, not even a president, which means a president cannot stop an investigation into his alleged illegal acts.

Yet in recent weeks, Trump fired Attorney General Jeff Sessions who, at least, had possessed enough integrity to recuse himself from special counsel Robert Mueller’s investigation into Trump’s possible collusion with Russia in the 2016 election.

Trump replaced Sessions with an inexperienced loyalist hack, Matthew Whitaker, whose only distinction to date has been loud and public condemnation of that investigation. As a conservative legal commentator on CNN, Whitaker even suggested that a clever attorney general could secretly starve the investigation of funds.

There’s no question why Trump appointed Whitaker. When asked by the Daily Caller, Trump made it clear. “As far as I’m concerned, this is an investigation that should have never been brought. It should have never been had. It’s an illegal investigation.”

The second principle of the rule of law is that a president cannot prosecute political opponents or critics. Decisions about whom to prosecute for alleged criminal wrongdoing must be made by prosecutors who are independent of politics.

Yet Trump has repeatedly pushed the Justice Department to bring charges against Hillary Clinton, his 2016 rival, for using a private email server when she was secretary of state, in alleged violation of the Presidential Records Act.

During his campaign, Trump led crowds in chanting “Lock her up,” called Clinton “crooked Hillary” and threatened to prosecute her if he was elected president.

After taking office, according to the New York Times, Trump told White House counsel Donald McGahn he wanted the Justice Department to prosecute Clinton. McGahn responded that Trump didn’t have the authority to do so and such action might even lead to impeachment.

Yet Trump has continued to press Justice Department officials including Whitaker when he served as Sessions’ chief of staff, about the status of Clinton-related investigations.

Never mind that Trump’s senior adviser and daughter Ivanka Trump sent hundreds of messages on her private email server to government employees and aides that detailed government business, policies and proposals or that other Trump officials have used their private email to conduct official business as well.

Breaking the rule of law doesn’t require consistency. It requires only a thirst for power at whatever cost.

The third principle of the rule of law is that a president must be respectful of the independence of the judiciary.

Yet Trump has done the opposite, openly ridiculing judges who disagree with him in order to fuel public distrust of them as he did when he called the judge who issued the first federal ruling against his travel ban a “so-called” judge.

Last week, Trump referred derisively to the judge who put a hold on Trump’s plan for refusing to consider asylum applications as an “Obama judge” and railed against the entire Ninth Circuit. “You go the Ninth Circuit and it’s a disgrace,” he said. He also issued a subtle threat: “It’s not going to happen like this anymore.”

In an unprecedented public rebuke of a sitting president, Supreme Court Chief Justice John Roberts condemned Trump’s attack. “We do not have Obama judges or Trump judges, Bush judges or Clinton judges,” said Roberts. “What we have is an extraordinary group of dedicated judges doing their level best to do equal right to those appearing before them. That independent judiciary is something we should all be thankful for.”

Trump immediately shot back, “Sorry Chief Justice John Roberts, but you do indeed have ‘Obama judges’ and they have a much different point of view than the people who are charged with the safety of our country.”

This was followed by another Trump threat on Twitter: “Much talk over dividing up the Ninth Circuit into two or three circuits. Too big!”

Almost a half century ago, another president violated these three basic principles of the rule of law, although not as blatantly as Trump. Richard Nixon tried to obstruct the Watergate investigation, pushed the Justice Department to prosecute his political enemies and took on the judiciary.

But America wouldn’t allow it. The nation rose up in outrage. Nixon resigned before Congress impeached him.

The question is whether this generation of Americans will have the strength and wisdom to do the same.

Robert Reich’s latest book is “The Common Good” and his newest documentary is “Saving Capitalism.”