There are few world leaders braver than Volodymyr Zelensky. Ukraine's president spends his time holed up in his capital, defending his homeland from an onslaught of invading Russian troops. He's addressed every major parliament in the West to plead for weapons and aid. Joe Biden calls him weekly; Emmanuel Macron has started to dress like him.

Given his present international standing, it's incredible to think that just six and a half years ago, Zelensky was settling down to watch himself play the president of Ukraine in the premiere of Servant of the People, the sitcom which...

There are few world leaders braver than Volodymyr Zelensky. Ukraine’s president spends his time holed up in his capital, defending his homeland from an onslaught of invading Russian troops. He’s addressed every major parliament in the West to plead for weapons and aid. Joe Biden calls him weekly; Emmanuel Macron has started to dress like him.

Given his present international standing, it’s incredible to think that just six and a half years ago, Zelensky was settling down to watch himself play the president of Ukraine in the premiere of Servant of the People, the sitcom which set the stage for his political career. (Prior to the show, which he co-created, Zelensky was best known for winning his country’s version of Dancing with the Stars in 2006 and for voicing the character of Paddington Bear in a 2014 film.)

In the series, Zelensky plays Vasily Petrovich Goloborodko. He is a run-down everyman high school teacher who finds himself elevated to the office of president of Ukraine thanks to a mixture of an impromptu anti-corruption speech that goes viral (“We’re choosing between two bastards!”) and behind-the-scenes shenanigans dictated by the nefarious prime minister and the Machiavellian oligarchs who control the workings of Ukraine.

Servant of the People unapologetically owes a debt to Hollywood films such as Dave and Mr. Smith Goes to Washington in its presentation of the collision between small-town decency and the cynicism of the political machine. Zelensky’s nuanced performance as Goloborodko — which shows him to be a considerably more accomplished actor than any of his co-stars — manages to combine the broadly farcical qualities that viewers might expect from such a protagonist with a quieter and more philosophical perspective. As his character — appropriately enough, a history teacher — explains to his students, “The truth is the truth, no matter how unpleasant.”

The jokes alternate between the basic, the sophisticated and the pointedly satirical. On the one hand, there are easy gags about Goloborodko being a loser drowning in debt who lives with his blowhard father, indulgent mother and wayward niece, which could have been taken from virtually any American domestic sitcom of the past half-century. On the other, it is hard to imagine an episode of All in the Family or How I Met Your Mother beginning with a philosophical discussion between Plutarch and Herodotus, just as one scene — which has already gone viral — revolves around the president’s exaltation at Ukraine’s apparent admission to the European Union, only for him to be informed almost immediately that it is a clerical error.

And, of course, subsequent events have given the program a social relevance that Zelensky and his co-writers could only have imagined while they were creating it. In the first episode, the new president is offered a choice of appropriately glitzy wristwatches, and his suspiciously smooth advisor suggests that he adopt a Hulot, “like Putin wears.” The premier says, apparently incredulously, “Putin, Hulot?” To a non-native Ukrainian speaker, the joke means little. But the humor comes from its being a play on a famous soccer chant — “Putin khuilo” — which essentially means “Fuck you, Putin.”

This spirit of defiance and nose-thumbing pervades the show, to both enjoyable and surprisingly poignant effect. Just as Mr. Smith went to Washington and made it a considerably better and more upstanding place — you might say he drained the swamp — so the unlikely president’s decency and integrity allow him to turn Ukraine from the oligarch-infested slough of dishonesty that he inherits to a better, more decent place. It is little surprise that the show’s popularity saw Zelensky stand for politics himself, nor that his platform enabled life to imitate art and become the country’s premier.

Yet watching Servant of the People is as sad as it is funny. With images of a ruined and bombed — if, crucially, never humiliated — Ukraine on the news bulletins night after night, it’s hard to believe that, a matter of a few weeks ago, it was a beautiful and vibrant country that was striding into the twenty-first century with conviction. And now, thanks to a dictator’s whims, it is engaged in an existential struggle for survival.

Whatever the outcome, future generations will watch Servant of the People as historical artifact, not light-hearted comedy. That is what may become its lasting legacy, not good-natured jokes about political incompetence.