In a move that will usher out the last remnant of late-night television's old guard, David Letterman announced Thursday that he will retire in 2015.

He broke the news during the taping of Thursday night's "Late Show," telling his studio audience that he had phoned CBS chairman and CEO Leslie Moonves just before the show to alert him to his plans.

"We have had this conversation in the past, and we agreed that we would work together on this circumstance and the timing of this circumstance," Letterman said. "I said, 'Leslie, it's been great, you've been great, and the network has been great, but I'm retiring.'"

In this photo provided by CBS, David Letterman, host of the  Late Show with David Letterman,  is seated at his desk in New York on Thursday, April 3, 2014.
In this photo provided by CBS, David Letterman, host of the Late Show with David Letterman, is seated at his desk in New York on Thursday, April 3, 2014. During taping of the Thursday night telecast, Letterman announced that he will retire in 2015 when his contract expires. (Jeffrey R. Staab/AP Photo/CBS)

The news comes as Letterman recently surpassed Johnny Carson as the longest-running host in late-night television history, hitting the 31-year mark. It also comes as TV's late-night scene is being taken over by much younger personalities.

In February, Jay Leno, 63, ended his 22-year run as host of NBC's "Tonight Show," handing the baton to Jimmy Fallon, 39.

Last year, Letterman, 66, renewed his contract with CBS in a two-year deal that was expected to be his last. As of next year, Letterman will have hosted "Late Show" on CBS for 22 years.

He also logged 11 years as host of NBC's "Late Night" before the network famously passed him over to hand Carson's late-night throne to Leno.

Word of Letterman's plan spread quickly via Twitter after musician Mike Mills, who appears on Thursday's show, noted Letterman's big news after the taping.

In addressing viewers, Letterman said, "I just want to reiterate my thanks for the support from the network, all of the people who have worked here, all of the people in the theater, all of the people on the staff, everybody at home, thank you very much. What this means now it that (band leader) Paul (Shaffer) and I can be married."

Letterman said that there is no precise timetable for his exit. "I think it will be at least a year or so, but sometime in the not too distant future -- 2015, for the love of God, in fact, Paul and I will be wrapping things up."

Moonves responded shortly after Letterman made his announcement.

"We knew this day was getting closer, but that doesn't make the moment any less poignant for us," he said. "For 21 years, David Letterman has graced our network's air in late night with wit, gravitas and brilliance unique in the history of our medium. ... There is only one David Letterman. His greatness will always be remembered here, and he will certainly sit among the pantheon of this business."

Moonves made no mention of an heir apparent, but speculation is already swirling around names such as Jon Stewart, Stephen Colbert, Chelsea Handler, Craig Ferguson and others.

Follow Chuck Barney at Twitter.com/chuckbarney and Facebook.com/bayareanewsgroup.chuckbarney.