NEW YORK (AP) -- From the start, David Letterman made sure the story of a $2 million shakedown attempt over his sex life was one he narrated himself.
It was the comic, not prosecutors, who broke the news of the case, which spurred him last fall to acknowledge affairs with women on his staff.
After former television producer Robert "Joe" Halderman pleaded guilty Tuesday to a blackmail attempt driven by debt and jealousy, Letterman seized the moment again. The late-night icon's lawyers were at the courthouse with a statement from him, and he weighed in on his show with praise for prosecutors and police.
"It was handled professionally, skillfully and appropriately," he said.
Letterman may be hoping the same is said of his own handling of the case, which at first dealt a blow to his image as a nice guy, if perhaps a little cranky.
Halderman, 52, pleaded guilty to attempted grand larceny, acknowledging he threatened to destroy Letterman reputation by airing his workplace dalliances -- using information authorities have said Halderman mined from the diary of a former girlfriend who had a relationship with Letterman.
The plea deal spares Halderman a potential 15 years in prison had he been convicted. He is due instead to get a six-month jail sentence and 1,000 hours of community service. "I attempted to extort $2 million from David Letterman by threatening to disclose personal and private information about him, whether true or false," he said in court Tuesday, apologizing to his ex-girlfriend and Letterman.
"I feel great remorse for what I have done," he said.
The plea also spares Letterman the prospect of a trial that could have put his private life on display, though he defused much of Halderman's potential bombshell last fall by revealing his affairs.
Halderman was a producer for CBS' "48 Hours Mystery" when the case began; Letterman's "Late Show" also is on CBS. CBS News said Halderman is no longer an employee but declined to specify whether he had quit or been fired.
Halderman acknowledged delivering the blackmail threat in September to Letterman's driver, in the form of a faintly fictionalized screenplay outline about the comedian. He admitted Tuesday the supposed script was "just a thinly veiled threat to ruin Mr. Letterman if he did not pay me a lot of money."
Defense attorney Gerald Shargel said Tuesday that Halderman "was both jealous and enraged" and under financial pressure. Halderman, who made about $214,000 in 2007, was struggling with money in the wake of a divorce, according to court papers filed by his ex-wife's lawyers.
Under the plea agreement, Halderman must give prosecutors all copies of any diary entries, photos, screenplay notes or other materials he has concerning Letterman and must agree never to reveal the contents.
Outside court, Halderman repeated his apologies, declined interviews and said no more. He remains free on bail until his sentencing, set for May 4.
His plea came more than four months after Letterman announced the case in an Oct. 1 monologue on his show, stunning viewers and impressing critics, who called his alternately folksy and frank speech a masterful move to seize control of the story. He described his office affairs as "creepy" but said he felt he needed to protect the women involved and his family.
Letterman married girlfriend Regina Lasko last year. They began dating in 1986 and have a 6-year-old son.
Fans have more than stuck with him since the disclosures of his workplace affairs. His show averages 4.14 million viewers, up 6 percent from a year ago.
But now, after beating rival Conan O'Brien on NBC's "The Tonight Show," Letterman is again facing Jay Leno, who returned to host "Tonight" last week after nine months' absence. In past years, Leno consistently beat Letterman in the ratings.
Manhattan District Attorney Cyrus R. Vance Jr. noted that Letterman had come to authorities knowing the case could expose his personal life.
"Mr. Letterman is a public figure, but like all New Yorkers he has a right to a certain degree of privacy in his public life," said Vance, who took over the case from predecessor Robert Morgenthau in January.