Mr. Halderman, an Emmy Award-winning producer for CBS News, was arrested on Oct. 1, after trying to deposit a fake $2 million check from a lawyer for Mr. Letterman in a sting operation set up by the district attorney’s office.

Image Robert Joel Halderman leaving court after his guilty plea. Credit... John Marshall Mantel for The New York Times

Sitting before Justice Charles Solomon of State Supreme Court in Manhattan, Mr. Halderman said in a calm tone, “I attempted to extort $2 million from David Letterman by threatening to disclose personal and private information about him, whether true or false.”

Mr. Halderman went on to explain that last Sept. 9, he gave a sealed envelope to Mr. Letterman’s driver while he waited in front of Mr. Letterman’s Manhattan apartment. The envelope contained several documents, he said, including one titled “Treatment for a Screenplay.”

Mr. Shargel had filed a motion to dismiss the case, arguing that Mr. Halderman intended only to write a book or a screenplay about Mr. Letterman’s affairs. But before going forward with the project, Mr. Halderman offered to sell Mr. Letterman the rights to the story for $2 million, according to the motion.

But in court on Tuesday, Mr. Halderman changed course. “This so-called treatment,” he said, “was just a thinly veiled threat to ruin Mr. Letterman if he did not pay me a lot of money.”

Mr. Halderman said he met three times with a lawyer for Mr. Letterman to negotiate the transaction.

“I knew throughout this time that I was not engaged in a legitimate business transaction with Mr. Letterman and that what I was doing was against New York law,” he said. “I understand that my attempt to extort $2 million from Mr. Letterman violated his and his family’s privacy. I promise to respect their privacy in the future.”