Under the big gray cloud, amid the general gloom, allow me to offer a ray of sunshine. The last two months have brought a pleasant surprise: Turns out the much feared, much predicted withering of our democratic institutions has been grossly exaggerated. The system lives.

Let me explain. Donald Trump’s triumph last year was based on a frontal attack on the Washington “establishment,” that all-powerful, all-seeing, supremely cynical, bipartisan “cartel” (as Ted Cruz would have it) that allegedly runs everything. Yet the establishment proved to be Potemkin empty. In 2016, it folded pitifully, surrendering with barely a fight to a lightweight outsider.

At which point, fear of the vaunted behemoth turned to contempt for its now-exposed lassitude and decadence. Compounding the confusion were Trump’s intimations of authoritarianism. He declared “I alone can fix it” and “I am your voice,” the classic tropes of the demagogue. He unabashedly expressed admiration for strongmen (most notably, Vladimir Putin).

Trump had just cut through the grandees like a hot knife through butter. Who would now prevent him from trampling, caudillo-like, over a Washington grown weak and decadent? A Washington, moreover, that had declined markedly in public esteem, as confidence in our traditional institutions — from the political parties to Congress — fell to new lows.

The strongman cometh, it was feared. Who and what would stop him?

(Bastien Inzaurralde/The Washington Post)

Two months into the Trumpian era, we have our answer. Our checks and balances have turned out to be quite vibrant. Consider:

1. The courts.

Trump rolls out not one but two immigration bans, and is stopped dead in his tracks by the courts. However you feel about the merits of the policy itself (in my view, execrable and useless but legal) or the merits of the constitutional reasoning of the 9th Circuit Court of Appeals (embarrassingly weak, transparently political), the fact remains: The president proposed and the courts disposed.

Trump’s pushback? A plaintive tweet or two complaining about the judges — that his own Supreme Court nominee denounced (if obliquely) as “disheartening” and “demoralizing.”

2. The states.

Federalism lives. The first immigration challenge to Trump was brought by the attorneys general of two states (Washington and Minnesota) picking up on a trend begun during the Barack Obama years when state attorneys general banded together to kill his immigration overreach and the more egregious trespasses of his Environmental Protection Agency.

And beyond working through the courts, state governors — Republicans, no less — have been exerting pressure on members of Congress to oppose a Republican president’s signature health-care reform. Institutional exigency still trumps party loyalty.

1 of 83 Full Screen Autoplay Close Skip Ad × See what President Trump has been doing since taking office View Photos The beginning of his term has featured controversial executive orders and frequent conflicts with the media. Caption The beginning of the president’s term has featured controversial executive orders and frequent conflicts with the media. March 17, 2017 President Donald Trump, first lady Melania Trump and their son, Barron, walk to Marine One at the White House en route to Mar-a-Lago in Palm Beach, Fla. Jabin Botsford/The Washington Post Buy Photo Wait 1 second to continue.

3. Congress.

The Republican-controlled Congress (House and Senate) is putting up epic resistance to a Republican administration’s health-care reform. True, that’s because of ideological and tactical disagreements rather than any particular desire to hem in Trump. But it does demonstrate that Congress is no rubber stamp.

And its independence extends beyond the perennially divisive health-care conundrums. Trump’s budget, for example, was instantly declared dead on arrival in Congress, as it almost invariably is regardless of which party is in power.

4. The media.

Trump is right. It is the opposition party. Indeed, furiously so, often indulging in appalling overkill. It’s sometimes embarrassing to read the front pages of the major newspapers, festooned as they are with anti-Trump editorializing masquerading as news.

Nonetheless, if you take the view from 30,000 feet, better this than a press acquiescing on bended knee, where it spent most of the Obama years in a slavish Pravda-like thrall. Every democracy needs an opposition press. We damn well have one now.

Taken together — and suspending judgment on which side is right on any particular issue — it is deeply encouraging that the sinews of institutional resistance to a potentially threatening executive remain quite resilient.

Madison’s genius was to understand that the best bulwark against tyranny was not virtue — virtue helps, but should never be relied upon — but ambition counteracting ambition, faction counteracting faction.

You see it even in the confirmation process for Neil Gorsuch, Trump’s supremely qualified and measured Supreme Court nominee. He’s a slam dunk, yet some factions have scraped together a campaign to block him. Their ads are plaintive and pathetic. Yet I find them warmly reassuring. What a country — where even the vacuous have a voice.

The anti-Trump opposition flatters itself as “the resistance.” As if this is Vichy France. It’s not. It’s 21st-century America. And the good news is that the checks and balances are working just fine.

Read more from Charles Krauthammer’s archive, follow him on Twitter or subscribe to his updates on Facebook.