Bob Newhart and Mark Harmon

Shooting a scene in the autopsy lab on the NCIS set, Bob Newhart looks a bit absentminded, and an interloper might not know whether to chuckle. The TV legend is playing Dr. Walter Magnus, who preceded Ducky (David McCallum) as the unit's medical examiner. Looking over a corpse with Gibbs (Mark Harmon), Ducky suggests their old colleague add his forensic two cents. "Walter, why don't you jump into some scrubs? ...Walter?"

Newhart's hesitancy in responding isn't far off from the trademark stammer he made into a science on two of TV's most beloved sitcoms, The Bob Newhart Show (1972-78) and Newhart (1982-90). Since NCIS is a drama in touch with its lighter side, you might guess the visiting icon was cast in "Recruited" to capitalize on his levity. Not so. The former doc is starting to fade mentally and, in a poignant twist, revisits his old haunts to see if they stir some memories.

"I know this guy," says Newhart, taking a break between scenes. "Well, I'm getting closer to knowing this guy." This dramatic gig isn't completely out of character for Newhart, who was Emmy-nominated for a three-week run on ER in 2003. "That was [exec producer] John Wells' idea," he says. "There was nothing in my previous history to suggest I could carry that off, but he felt I could. That was a guy with macular degeneration who worked with his hands and wound up killing himself. That's something I could never consider, having four kids and nine grandkids and loving life, but I could understand how this guy got there. In this script, it's a similar thing, with a guy who had to give up what he loves."

There's no danger of the 81-year-old Newhart giving up his life's work. "People say, 'Why don't you retire?' But as long as you're physically able, how can you [be] tired of making people laugh?" he asks. "The travel's a pain in the ass and I would never go back into a weekly grind — that's for young people. But I still love comedy."

On NCIS, "they encouraged me to make it as light as I wanted to," he says, although circumstances didn't allow for much of that. "Mark said to the director, 'We've got Bob, so let's put a phone call in,'" alluding to one of his comedic trademarks. "I said, 'Let me fool with it.' I was trying to walk a line between being funny and maintaining the integrity of the show — not to have the show stop for a Bob Newhart moment."

A set visitor wonders if his character might recur, à la recent NCIS guest Robert Wagner. "They're gonna have to hurry," points out Newhart, whose character's prognosis is grim. Exec producer Gary Glasberg passes by and says all hope is not lost. "We'll do some crossover with House and cure you," he jokes. "You were on the wrong medication. Too much Viagra or something."

Newhart says his wife of 48 years, Ginnie, is the biggest NCIS fanatic in the family, having gotten hooked on constant USA Network repeats while recovering from a liver transplant in 2009. "We go out for dinner every Tuesday with Tim Conway and Mike Connors and their wives, but we always make it home by eight — that's one of the conditions." He would've taken the gig without spousal nudging, though: "If you can pick and choose, why not go with the No. 1 drama on TV?"

NCIS airs Tuesday at 8/7c on CBS.

Subscribe to TV Guide Magazine now!