“‘I am the Lord your God. Thou shalt worship no other god before me.’ Boy, those were the days, huh?”

Thus do we meet President Josiah Bartlet (Martin Sheen), Democrat of New Hampshire, in the pilot of “The West Wing,” which premiered Sept. 22, 1999.

Having your protagonist’s first line be the literal words of the Almighty is, shall we say, a statement. This was a series that saw politics as civic religion. It was a work of patriotic evangelism that appealed to our better angels but failed to match up to earthly reality.

But before it was all that, it was a well-crafted, emotional workplace drama. The pilot finds the White House amid a number of crises, personal, political and in between. A flotilla of Cuban refugees headed for Florida is in danger. Sam Seaborn (Rob Lowe), one of the president’s aides, has unknowingly slept with a prostitute. Another aide, Josh Lyman (Bradley Whitford), may lose his job after having embarrassed a prominent religious conservative in a TV appearance. And President Bartlet has injured himself crashing a bicycle into a tree.

The episode, written by the creator, Aaron Sorkin, and directed by Thomas Schlamme, establishes the show’s signature look and energy. The camera races to keep up with the staff; the dialogue has the rat-a-tat brio of a ’30s screwball comedy. The score, by W.G. Snuffy Walden, sauces the action in star-spangled emotion. Smart, smart, smart!, the pilot says. Busy, busy, busy!

Above all, the pilot establishes the show’s core fantasy: That the right thing and the politically effective thing are the same thing. Josh drags himself into a forced-apology meeting with a religious group. It goes badly: His main antagonist shows herself to be a sour, mean-spirited antisemite, and the meeting devolves into a shouting match, interrupted by Bartlet, who corrects a guest’s misquote of the First Commandment.

The Christian envoys want an apology and a policy concession in lieu of Josh’s head on a platter. Bartlet, leaning jauntily on a cane, has something else for them. It turns out he crashed his bike because he was upset that a group of anti-abortion extremists threatened his granddaughter for supporting “a woman’s right to choose” in a magazine interview. “You’ll denounce these people,” he says, “and until you do, you can all get your fat asses out of my White House.”

Afterward, the president pays homage to the Cubans who died trying to sail for freedom and warns Josh to keep his nose clean. Stirring music swells up as he and his reverent staff turn back to doing the people’s business. Cue credits. God bless America.

I was an early skeptic of “The West Wing.” I didn’t like its sermonizing or the way it stacked the deck in favor of its paragons of public service. I lamented its Emmy dominance, in its first four years, over HBO’s “The Sopranos.” (“Anyone who still believes ‘The West Wing’ is a better show than ‘The Sopranos,’” I wrote in 2001, “does not deserve to own a television.”)

But I also happily watched every episode of the show for seven seasons. Just as a president must have some authentic appeal to be elected, a show can’t become a phenomenon like “The West Wing” without being good at something. It was the last, lusty gasp of the big, morally uncomplicated network melodrama, and it knew how to pluck our heartstrings like a concert harp.It’s the political wish-fulfillment of “The West Wing” that has aged worst. The series premiered late in the compromising, triangulating Bill Clinton presidency. It offered a fantasy alterna-Washington of steel-spined liberals who knew their commandments as well as their amendments, who stuck to their guns (or their gun control) and won.

Even as the series moved into the 2000s, it really stayed a 1990s show. Republican George W. Bush squeaked by in the Florida recount, but on “The West Wing” Bartlet easily annihilated James Brolin’s quasi-Dubya, whose know-nothing blathering the Nobel laureate economist Bartlet found contemptible.

In Bartlet’s America, voters reward you for fighting lies and fearmongering with facts and reason. Good intentions and great oratory win the day. Well-meaning people reach across the aisle and reason with their colleagues. Politics is an earnest battle of ideas, not a consuming war of all against all.

Just as “24” oversimplified the war on terror, “The West Wing” propagated a Vaseline-lensed image of politics. A quarter-century after the show’s premiere, strategist Elizabeth Spiers writes, political professionals still suffer from “Terminal ‘West Wing’ Brain,” a condition marked by the belief that Americans yearn to compromise and unify for the sake of the common good.

And not only political professionals. Shortly before the nomination of Kamala Harris, none other than Sorkin suggested that the Democrats replace President Joe Biden with ... Mitt Romney, a twist that indeed only Sorkin could make up. (In the fourth-season finale, Sorkin’s last episode with the series, Bartlet temporarily steps aside from office in favor of the Republican speaker of the House.)

The show’s dedication to bipartisan uplift was of a piece with its old-fashioned narrative style. “The West Wing,” which aired on NBC, was at heart a 20th-century broadcast network drama. It needed unambiguous good guys at its center, and it needed to give them wins.

But it came along just as TV drama was radically changing, in the same year as “The Sopranos.” Tony Soprano’s America was declining, its conflicts were brutal and everybody was in it for themselves. The system, in “The Sopranos,” was not an essentially good machine that just needed competent, selfless stewards. It was a gilded pyramid that stunk from the top while misery oozed downhill.

In retrospect, those Emmy showdowns between “The West Wing” and “The Sopranos” were not just battles for the artistic soul of TV. They were an argument about the nature of the country. And the ensuing quarter-century of war, corruption, fecklessness, bigotry, violence and the collapse of trust — they all suggested that where we live is much closer to Tony Soprano’s America than to Jed Bartlet’s.