Former British prime minister Margaret Thatcher. (Gabriel Duval/AFP)

On Jan. 20, 1984, Margaret Thatcher issued an order to Jim Hacker, a member of her Cabinet, and Sir Humphrey Appleby, a senior bureaucrat. She wanted to purge the government of everyone with a qualification in economics.

“What are your degrees?” Thatcher asked Sir Humphrey. “Politics and …” Sir Humphrey trailed off. “Yes?” Thatcher insisted. “ … economics,” Sir Humphrey conceded. “Capital!” Thatcher concluded with a flourish. “You’ll know exactly where to start!”

Hacker and Sir Humphrey were characters from “Yes, Minister,” a cerebral television comedy that satirized the arranged marriage between feckless politicians and savvy bureaucrats. Thatcher loved the show, and pushed to appear in this one-off sketch, after which she presented the writers and actors with an award from the National Viewers’ and Listeners’ Association, now known as Mediawatch-UK.

“Yes, Minister” drew upon ideas that were popular in academic and government circles during the 1970s and 1980s. Co-creator Anthony Jay was drawn to the new public choice theories that swept the study of government. Thinkers, such as James Buchanan and William Niskanen, argued that politicians and bureaucrats fought each other for control of policy and resources.

Bureaucrats had the upper hand, Niskanen thought. They stayed in their jobs for longer and knew more about the issues involved. Politicians naively gave them much of what they wanted. Society suffered from an oversupply of services as each bureaucracy squeezed more than it needed from the public purse.

These ideas were at the center of the Thatcher and Ronald Reagan administrations in Britain and the United States, which favored cutting government and shifting its functions to the private sector. When Thatcher watched “Yes, Minister,” she saw Sir Humphrey as the embodiment of the bureaucratic monster she must slay. Hacker represented the kind of soppy, upper-class politician who would be useless in the fight.

And yet, there was another strain of thinking in “Yes, Minister.” It came from Jay’s creative partner Jonathan Lynn, a leftist. Whilst Jay’s target was big government, Lynn took aim at the pompous conservatives he had studied with at Cambridge University, some of whom had gone on to become members of Thatcher’s government. Where Jay had sympathy for some of the Thatcher/Reagan program, Lynn was appalled by it. He believed the privatization of government services would enrich big corporations at the expense of the most vulnerable in society.

“You can’t always choose your fans,” Lynn said when he found out the prime minister liked his work.

Lynn was further appalled when he saw the script for the Thatcher skit. “To say that it wasn’t funny would be something of an understatement,” Lynn recalled. “We wondered if the prime minister had really found the time to sit down and write this crap.” Aside from its comedic deficiencies, the sketch was nonsensical: Had Thatcher succeeded in abolishing the profession of economist, she would have destroyed the intellectual foundation of her own government. The thrust of the public choice movement was to apply ideas from economics to the analysis of politics.

Disdainfully accepting the award after the sketch, Lynn thanked Thatcher for “finally taking her rightful place in the field of situation comedy.”

“It got the biggest laugh of my career,” he remembered. “The room was rocking, everybody except one person: Mrs. Thatcher. ‘We are not amused,’ her face plainly said.”

“Yes, Minister” began as a sitcom and became a social icon. The writer Armando Iannucci, who created two superb political satires, “The Thick of It” and “Veep,” believes that “Yes, Minister” is the best British comedy series ever made.

“It’s a mark of the show’s subversive influence,” Iannucci said, “that we now cannot trust a politician if he sounds like a character from ‘Yes, Minister,’ or deploys the sort of malformed logic for which the program was famous. If it’s depressing that this sort of logic is still used, it’s a cause for rejoicing that we now have the means to identify it.”

“Yes, Minister” was the formative political experience for a generation of British politicians. When they went into government themselves, they were determined not to become the pawns of the bureaucracy.

“These were young people who’d grown up watching the show,” said Bernard Donoughue, a veteran politician who served as a consultant to Jay and Lynn and later joined Tony Blair’s Labour government. “And some of them … were out to demonstrate their masculinity by not listening to their civil servants.”

“They hadn’t a clue what to do,” Donoughue recalled, “But you could really hear them say this: ‘I’m not going to let Sir Humphrey run me!’”

Watching “Yes, Minister” now, one is struck by its continued relevance. Supporters of President Trump will find no greater demonstration of the practices of the deep state than the mellifluous Sir Humphrey, frustrating every policy initiative with a well-timed leak here, a mischievous bit of misdirection there. Those alarmed by our current president will take solace, too. “Yes, Minister” reminds us while politicians bluster and blunder, they also come and go. Bureaucracy is permanent, and always wins in the end.

Stephen Benedict Dyson is an associate professor of political science at the University of Connecticut. He is writing a book about how political television and political science produce, and are produced by, the politics of the time. Follow him on twitter @sbdyson.