Jay Leno, NBC's perennial late-night ratings giant, celebrated the 50th anniversary of "The Tonight Show" last night by announcing that he is a lame duck and that Conan O'Brien will replace him when his contract expires in 2009.

About three hours before Leno made the "surprise" announcement to his Burbank, Calif., studio audience during the taping of last night's show, NBC had blasted an e-mail to the news media, announcing that it had signed a deal giving the 41-year-old O'Brien the 11:35 p.m. time slot he wanted and that Leno would bow out at the end of the five-year contract he'd signed just six months ago. Until then, O'Brien will continue to host "Late Night," the network said.

Neither Leno nor O'Brien would talk to reporters yesterday, the spokeswoman for NBC Entertainment assured us. According to the network, O'Brien will wait until tonight to discuss the deal on the air.

O'Brien, whose contract was to expire in December 2005, had been very public about his displeasure when NBC locked up Leno on the "Tonight Show" through the end of the decade. O'Brien made no bones about the fact that he thought he deserved the earlier time slot after 11 years following Leno. Soon, reports emerged that he was being wooed by other networks.

In its news release yesterday, NBC said: "Jay Leno will officially make the announcement during the evening's 'Tonight Show' -- a show that also celebrates the 50th anniversary of the late night institution."

Yes, this is how the network thanks the guy who has opened hundreds of shopping malls and kissed thousands of drooling babies, all for the sake of promoting the franchise that is now the second most profitable program on its lineup, behind only "Today."

"NBC Late Night Succession Plan Announced: Jay Leno to turn over 'The Tonight Show' to Conan O'Brien in 2009," NBC boasted in its news release.

It quotes Leno as saying that in 2009 he will be 59 years old and will have had his "dream job" for 17 years. "Only one person has done this in his sixties, and that was Johnny Carson, and I think it's safe to say I'm no Johnny Carson," Leno said modestly during last night's telecast.

Carson, his predecessor, hosted the show 30 years and retired at age 66.

Leno is also quoted in the release as saying that when he signed the contract earlier this year, he felt "that the timing was right to plan for my successor." Last night on the show, he said that after signing the deal, there was "all this talk" about what it would mean for O'Brien and that NBC execs had come back to Leno saying, "We don't want to lose Conan." Leno said his response was, "What does that mean?"

Seven weeks after announcing Leno's new contract, O'Brien savaged him in front of hundreds of advertising execs at Radio City Music Hall during NBC's presentation of its new prime-time lineup. Members of the audience gasped or snickered when he did a dead-on imitation of car-collecting Leno:

"Ehh! I've been signed through 2055! I can buy another Stanley Steamer!"

It seems NBC also neglected to pass along Leno's succession plans to the New York Times' Bill Carter, who wrote the book (literally, as well as the HBO screenplay) on NBC's late-night intrigues. Carter wrote in April that "NBC doesn't seem to be contemplating Mr. Leno's retirement -- ever." That was followed by yet another snippy O'Brien line on the subject: "Jay may decide he wants to do the show until 2025. Jay could say: My brain will be in a jar and we'll wheel it out and I'll do the monologue."

Television industry executives contacted yesterday weren't surprised that O'Brien had been told he would get "Tonight" when Leno's contract ran out. They were very surprised, however, that it had been written into O'Brien's new contract and that NBC Universal Television Group President Jeff Zucker had gotten Leno to agree to quit in five years -- and on a night that was supposed to have been about celebrating the long-running franchise and Leno's own ratings supremacy.

The execs spent yesterday praising or damning Zucker for orchestrating the deal and for its timing.

"This sounds like a classic Zucker move: It's the 50th anniversary show; let's make a big announcement and figure out how it's all going to work later," said one Zucker detractor, who wanted to remain nameless because that's how it's done in Hollywood when you're detracting.

Zucker fans, meanwhile, praised his ability to persuade O'Brien to agree to a promotion that won't happen for five more years, while getting workaholic Leno to accept the need for his own departure.

"Only time will tell if it actually plays out as described. It's five years from now -- that's a long time," said one admirer, who also did not want his name attached lest he offend Zucker detractors.

Zucker fans also credit him, and Leno, with avoiding an unpleasant situation such as what occurred in 1992 when NBC picked Leno over David Letterman to take over "Tonight" from Carson. Letterman wound up leaving NBC to take on "Late Show" at CBS, where he initially beat his rival in the ratings. But after Hugh Grant turned up on "Tonight" in 1995 to discuss his close encounter with a Hollywood hooker, viewers migrated over to Leno, who has prevailed ever since.

In agreeing to make the announcement last night, Leno told his studio audience, he hoped to avoid repeating the mistake NBC suits had made in the early '90s, a mistake that resulted in "a lot of animosity" between Leno and Letterman factions. "A lot of good friendships were permanently damaged," Leno said.

He said he regards the show as a "dynasty" that should be handed down from person to person, and wrapped up his comments by saying, "Conan, it's yours. See you in five years, buddy."

In an e-mail sent to NBC staffers shortly before yesterday's announcement, Zucker said, "I can't say enough about this late night team and these two men -- especially Jay Leno -- who worked tirelessly with us to help us find the appropriate time to make this announcement."

CBS wasted no time yesterday putting out a news release to note that Letterman had finished the first week of the TV season in his closest competitive position to Leno in a decade and actually beat "The Tonight Show" last Monday among all viewers and in the 18-to-49-year-old demographic that NBC targets. That's thanks in some measure to the large number of people who had tuned in to the season debut of CBS's "CSI: Miami" and stuck around for Letterman, compared with the much smaller audience delivered by NBC's 10 p.m. drama "LAX."

NBC quickly responded with another news release noting that Leno won last week by more than a half-million viewers and beat Letterman every night except Monday, when Democratic presidential nominee John Kerry appeared on the CBS show.

The move to replace Leno is a fitting end for O'Brien. A former writer on "The Simpsons," he was considered such a long shot by NBC suits when late-night producer Lorne Michaels named him to replace Letterman on the post-"Tonight" show that the network at first gave him contract renewals that were only weeks long.

"Late night talent is a rare commodity. Cultivating it and keeping it has always been a priority here, and with this announcement, we couldn't be in a better place," NBC Entertainment President Kevin Reilly said in the announcement, with no trace of irony.

Oprah Winfrey helps Jay Leno celebrate the 50th anniversary of "The Tonight Show" last night.