Deputy editorial page editor

As this appalling year limps to a close, with President Trump consistently underperforming even the lowest of expectations, a note of holiday cheer: Our country's institutions and values have, so far, proven remarkably resilient.

This outcome was not a given; complacency that it will continue would be dangerous. And yet, after nearly a year of Trump, the warnings about incipient fascism and the insidious ways strongmen acquire power feel overblown. I suspected so from the start, but I wasn't sure — nor should we be cocky about the future.

Still, for now, there are reasons for optimism in the performance of the media, the courts and, yes, even the Republican-dominated Congress — undergirded and reinforced by the American people.

On the media: How scary it is to have a president who derides us as "the enemy of the American people." To have a cable news network that inflames his worst instincts and recklessly flings suggestions of a "coup" by special counsel Robert S. Mueller III. To have nearly half the public, egged on by Trump's bellowing about "fake news," believing that reporters simply invent negative stories about the president.

But while Trump & Co. went to war against the press, we went to work, to paraphrase Post Executive Editor Martin Baron. Without that work, the public would probably not know about: former national security adviser Michael Flynn's contacts with the Russians; Donald Trump Jr.'s "I love it" meeting with a Russian lawyer peddling dirt on Hillary Clinton, and the president's efforts to mislead people about the event; Trump's description of fired FBI director James B. Comey as a "nut job" in a meeting with Russian officials in which he also divulged highly classified information. The list goes on.

And for all the Trump-fomented anger at and distrust of the media, the president has stirred up something else. For the first time in my career, people are thanking me and my colleagues for what we do, a development that is at once gratifying and unsettling. (It's our job.) Digital subscriptions are soaring at The Post and the New York Times, which helps provide the resources for more rigorous reporting.

The courts have also stood their institutional ground — notwithstanding, and perhaps in response to, Trump's demonstrated contempt for an independent judiciary. All three versions of Trump's misguided effort to ban entry of citizens from certain Muslim-majority nations have been struck down by courts, although the Supreme Court has allowed the latest one to take effect while the litigation continues. So was his attempt to deny federal funding to so-called sanctuary cities. So was his cruel, ignorant effort to ban transgender people from serving in the military. So was his bid to prevent undocumented teenagers from exercising their right to abortion.

All of this could be ephemeral. The ideological balance of the Supreme Court is precarious, and the seat that was denied to President Barack Obama (and Merrick Garland) and occupied by Justice Neil M. Gorsuch will matter long after we are rid of Trump. In contrast to Trump's incompetence in staffing up the executive branch, and with the exception of a few jaw-droppingly unqualified lower-court nominees, the Trump team has been diligent in filling the judicial vacancies Senate Majority Leader Mitch McConnell (R-Ky.) maneuvered to leave for him.

It is beyond naive to think that these changes won't matter. But I am not — not yet? — disillusioned enough to believe that this transformation will leave the separation of powers and the rule of law defenseless. A Trump- ­infused judiciary will not always rule the way I would like, but I remain confident that even conservative judges and justices would resist his most authoritarian, unconstitutional impulses.

And speaking of separation of powers, there is Congress. It may strain optimism to consider congressional Republicans, with their rammed-through tax bill and fawning obeisance to Trump, as any kind of bulwark against his excesses.

Yet we have seen repeated episodes of congressional resistance, enough of it to make a difference, whether to manifestly unqualified judicial nominees or to ill-intentioned efforts to dismantle the health-care law. Even this Congress, even before the changes that 2018 may bring, has pursued investigations into Trump's Russia ties and would rebel at any effort to fire Mueller or obstruct his probe, despite the current outcry.

I am not saying this has been a good year. Indeed, it was dreadful. But if Trump was even worse than we expected, our system, imperfect and battered as it is, withstood the onslaught. This is a terrible moment in our nation's history, but I am betting it is just that — a moment, not a death knell.

Read more from Ruth Marcus's archive, follow her on Twitter or subscribe to her updates on Facebook.