NEW YORK - (AP) - A TV news producer accused of blackmailing David Letterman in exchange for keeping quiet about his sexual affairs was only trying to sell the late-night comic a screenplay, a defense lawyer said Tuesday.

Robert J. "Joe" Halderman's lawyer asked a judge to toss the attempted first-degree grand larceny case, saying the producer did nothing illegal in slipping Letterman documents alluding to the "Late Show" host's dalliances and taking a $2 million check from Letterman's lawyer.

In papers filed Tuesday, Shargel argued that the indictment against Halderman should be dismissed because his conduct wasn't a crime, among other claims. Assistant District Attorney Judy Salwen said she was confident a judge would find the indictment was on solid legal ground.

State Supreme Court Justice Charles Solomon is expected to rule in January. Horwitz said Letterman is prepared to testify if the case goes to trial.

Halderman acknowledges getting a package into Letterman's car on Sept. 9 that included the supposed screenplay "treatment" - or synopsis - and some "source material."

Authorities say the materials included a letter saying Halderman needed to make "a large chunk of money" and a claim that the screenplay would depict how Letterman's world would "collapse around him" when information about his private life was disclosed. Photos, personal correspondence and portions of a diary also were enclosed, authorities said.

The diary entries were allegedly written by Halderman's former girlfriend and outlined her affair with Letterman.

The day before prosecutors unveiled the case last month, Letterman divulged it on his show, acknowledging he had had sex with women who worked for him.

Shargel's court filing said Halderman simply realized he had "a valuable subject for a book or a movie" and sold it to Letterman, threatening to do nothing more than sell it elsewhere if the TVhost rejected it.

The 51-year-old producer for CBS' "48 Hours Mystery" has pleaded not guilty. He could face five to 15 years in prison if convicted.