"For four years, I had the best job in show business," Sorkin said at the PaleyFest panel Friday night.

The West Wing was an accident. At opening night of PaleyFest on Friday, creator Aaron Sorkin said that he never intended to do television, and when his agent set up a meeting with producer John Wells, he didn't plan to pitch anything.

Then on the evening of their meeting, Sorkin's friend and Beautiful Mind writer Akiva Goldsman suggested there might be a TV show in the premise from Sorkin's film The American President. Only instead of romance, it should be about the senior staff. So when Sorkin showed up to the lunch and saw Wells with a group of executives and agents, he immediately pitched the concept.

But Sorkin acknowledged that television shows about politics can be difficult, both for advertisers and audiences. "The conflict was going to be ideas, and some people were going to disagree with those ideas," Sorkin said.

In an initial focus group, the show did not test very well, but Sorkin had a plan. "If the first focus group doesn't work, make your own focus group," he said. He gathered a test audience who all shared a crucial factor in common: access to internet. It was the height of the tech boom in the late '90s, and the dot-coms needed somewhere to advertise. This focus group loved the show, and that's how it got on the air.

At the panel, Sorkin chose to screen the episode "Two Cathedrals," which was the finale of the second season and is considered by many fans to be one of the series' best episodes. One of the series' early central conflicts about the president hiding his multiple sclerosis comes to a head when he must divulge the information to the American people and face the question of re-election and a criminal trial.

"That now feels like a relatively minor crime," Sorkin said, noting that the past few weeks have had their share of political turmoil with the impeachment inquiry. "It seemed like a big deal when I wrote it."

Sorkin praised director Tommy Schlamme for the success of the episode, which Sorkin said he hadn't seen in years. One of the most famous scenes is when Martin Sheen as President Bartlet curses at God after the memorial service for his longtime assistant Mrs. Landingham, who died in a drunk driving accident. The scene was shot in the National Cathedral in Washington, and Bartlett utters a few phrases in Latin throughout his tirade.

"If you want to get a couple past Standards and Practices, write it in Latin," Sorkin said. "He said some words you cannot say."

He also praised the ensemble cast, saying he constantly had the problem of having too many mouths to feed. He remembered thinking it would be impossible to cast a movie star like Rob Lowe in an ensemble drama, but Lowe made it "impossible not to cast him." And he noted that Janelle Moloney kept finding her way into each episode as Josh's assistant Donna, but Moloney didn't quit her waitressing job until season two when she became a series regular.

Sorkin said his writing process for the show consisted of driving around and having arguments with himself in the car. (A friend once gifted him a car headset because he looked crazy while driving.) He said he's often asked if the show was "too smart for TV," but he doesn't think that's true. "The West Wing wasn't good background music," Sorkin said, adding that viewers couldn't have it on while doing other things around the house.

When asked what The West Wing would be like today, he said, "I like to think it would be exactly the same."

"I feel romantic and idealistic about American institutions and Americans," he added, nothing that the American voter was always an offscreen character in the show.

Sorkin emphasized the importance of civics lessons and keeping young people informed by bringing better civics education to schools to help build the next generation of voters.

"In a Democracy, how can it not be the responsibility of the voters?" he asked, when an audience member suggested that better candidates are needed. He acknowledged that it's a two-pronged argument, for both better voters and candidates, and it almost seemed like he was ready to start writing a West Wing-like debate right there.

"Civics have to be taken serious in our schools," he said. "We need to make better voters, otherwise it's bound to descend into the tribalism that we have now."