Last week, the risk to a precious national institution — to its quality and its independence and sheer ability to function — came into sharp focus.

No, I’m not talking about the Supreme Court.

While we were all gripped by the Brett M. Kavanaugh saga, we were as usual paying too little attention to that endangered and essential national resource known as the federal civil service.

The week began with the honoring of a handful of federal workers with the annual Samuel J. Heyman Service to America Medals (the “Sammies”). The range of their exemplary contributions — from helping children with autism to nabbing scammers who prey on the poor to making the skies safe for a new era of flying drones — served as a reminder of how much we depend on government and the people who make it work.

The week ended with President Trump abruptly replacing the well-qualified head of the Office of Personnel Management, a reminder of the dangers facing the civil service — dangers that have been building for decades and have sharply intensified in the Trump era.

Start with this astonishing statistic: Fewer than 6 percent of the nation’s 2 million civilian workers are younger than 30. That compares to nearly one-quarter in the private sector. In government IT, Max Stier told me, there are more than five times as many people over the age of 60 as under 30.

As someone in the over-60 group, I’m allowed to say: That is terrifying.

“It’s devastating,” Stier says. “It’s a symptom of danger and sickness in our government. And it shouldn’t be. Young people do want to make a difference, and there is no place you could make a bigger difference than in government.”

But if you set out to design a system to repel the best of those mission-driven people, you might arrive at something like the way the federal government operates today.

Stier, founding executive director of the nonpartisan Partnership for Public Service, has been sounding this alarm — and proposing sensible fixes — for a long time. His organization hosts the Sammies, both to honor a workforce that is more often maligned and to remind the rest of us how much we rely on it.

Stier points out that the civil service rules were written in 1949 and last revised 40 years ago — when there was one Starbucks shop in the world.

They were written to promote equity in a largely clerical workforce. Now they stifle creativity in what has become a largely professional workforce.

The salaries of people who run hospitals or hospital systems for Veterans Affairs, for example, are capped at about a fraction of what directors could earn in the private sector. Yet we act surprised at VA’s management failures, which periodically are highlighted in a frenzy of congressional outrage.

Which points to another systemic failure: “We find what’s wrong; we never celebrate what’s right,” Stier says. “No organization gets better if you just kick it.”

All that has been true for a long time. And now we have a kicker in chief in the White House.

Trump maligned the government and its “swamp” to get elected. As The Post’s Robert O’Harrow Jr. has documented, he then staffed a number of agencies with politically connected hacks. His first appointees in some cases (Defense, the Food and Drug Administration) were committed to their agency’s mission in a way that bolsters morale, but in many others (State, the Environmental Protection Agency) seemed determined to undermine it.

One result: 18 percent of the government’s 7,000 top managers, the Senior Executive Service, bailed out in Trump’s first year, a significantly higher percentage than during President Barack Obama’s first year.

And now, Jeff Pon, an unusually well-qualified human-resources expert who took over at the Office of Personnel Management just seven months ago, is gone. The departure appears related to Trump’s desire to bring more of that agency’s functions into the White House, which will only increase the risks of politicization.

You wouldn’t know it by listening to politicians’ government-bashing, but the civilian workforce has held steady (at about 2 million) for a half-century, even as the nation’s population has grown and the missions (keeping airports and airliners terrorist-free, for example) have multiplied.

Two of the Sammie award winners last week were Karen D. Dodge, a staff attorney at the Federal Trade Commission, and Margaret Moeser, a senior trial attorney in the Justice Department. Backed, as they both were quick to point out, by hard- working teams, they led a complex investigation that eventually forced Western Union, the world’s biggest money-transfer company, to admit that it had turned a blind eye to scammers. Western Union refunded nearly $600 million to victims who, without that money, in many cases couldn’t make the rent or afford their medicine.

“Only the federal government can do work like this,” Moeser said.

She’s right. And if we just keep kicking the people who serve, and discouraging the people who would like to serve, we shouldn’t be surprised if less and less of her kind of work gets accomplished.

Read more: