Some of the recent news coverage of executive-branch resistance to the Trump agenda has invoked the notion of the "deep state," a phrase hinting at sinister, unelected bureaucrats undermining the agenda of an elected president. But bureaucratic resistance to presidential control does not necessarily subvert democracy. To the contrary, it often affirms it.

Executive-branch careerists — bureaucrats — have long been the whipping boys of our political discourse. Whenever voters, commentators or politicians don't like agency policies, it is easy to blame "unelected bureaucrats" acting in anti-democratic ways.

But remember, Congress and the president use statutes to define the missions of executive-branch agencies, and agency staff consists mostly of people who are committed to that mission. The people who work at the Securities and Exchange Commission (SEC) are dedicated to policing capital markets to ensure that they are fair. The people who work at the Food and Drug Administration (FDA) are dedicated to protecting consumers from harmful drugs. And the people who work at the Environmental Protection Agency (EPA) are dedicated to environmental protection.

Sometimes presidents appoint agency heads who try to subvert that statutory mission from within. This is nothing new. Anne Gorsuch Burford, mother of current Supreme Court nominee Neil Gorsuch, was forced to resign her position as Ronald Reagan's first EPA administrator partly because agency careerists effectively mustered public and congressional opposition to her leadership. This dynamic is sufficiently common that academics have studied it for decades.

The crucial point is this: In our democracy, public preferences get translated into policy through lawmaking, not simply through elections. The election of any president does not necessarily signify a public desire to change an agency's mission or repeal any particular law.

Meanwhile, executive-branch agencies remain obliged to implement the securities laws, food and drug laws, environmental laws and the various other statutes that define the modern administrative state. This is part of what we mean by "the rule of law," and it is entirely consistent with the framers' desire for government to produce policy decisions that resist the kind of temporary passions that loom so large in today's polarized politics, and instead reflect the "permanent and aggregate interests of the community," as James Madison framed it in Federalist No. 10.

To be sure, it is the president's constitutional role to oversee agencies as they discharge their statutory duties. But that process must always remain within statutory boundaries. If a president is unhappy with the basic mission of the SEC, FDA or EPA, the appropriate remedy is to redefine that mission through legislation. When the president instead tries to undermine that mission by appointing an agency head willing to try to subvert it, resistance by careerists doesn't undermine democracy or the rule of law — rather, it vindicates those principles.

Certainly, overzealous agencies sometimes stretch their statutory authority beyond recognition. In those instances we rely on the courts to keep agencies in their jurisdictional lanes and to enforce the rule of law. Hence all the litigation reviewing the Obama administration's implementation of the Affordable Care Act, the Clean Air Act and other laws.

But courts will also discipline presidents who try to steer an agency away from its statutory mission. That is how President George W. Bush's EPA lost a succession of high-profile court cases challenging its interpretations of the Clean Air Act. The Trump administration's recent promise not to replace the Clean Power Plan may meet the same fate.

The Trump administration has made clear its intent to roll back regulation in ways that may contradict agencies' enabling legislation. When that happens, expect courts to push back. If Republicans want to "deconstruct" the administrative state, as Trump senior adviser Steve Bannon says, changing presidents is not enough. They will have to change the law.

David Spence is a professor of law, politics and regulation at the University of Texas at Austin. He wrote this article for the Washington Post.