"Curb Your Enthusiasm," an HBO show known for its acerbic wit, accidentally helped deliver a happy ending to a man who had been charged with murder.

Juan Catalan spent five and a half months in jail on murder charges before his attorney found video footage taken by the show at Dodger Stadium that backs up his client's claims of innocence.

Police arrested Catalan in August, alleging he killed Martha Puebla, 16, in the San Fernando Valley on May 12, 2003, because she had testified against his brother in another case.

Get Breaking News Delivered to Your Inbox

Catalan insisted he and his 6-year-old daughter were watching the Los Angeles Dodgers lose to the Atlanta Braves, 11-4, minutes before Puebla was killed about 20 miles north of the stadium.

He said he had ticket stubs from the game and testimony from his family as to his whereabouts the night Puebla was killed. But police still believed he was responsible, saying they had a witness who placed Catalan at the scene of the slaying.

Catalan said he asked to take a lie detector test, but was refused.

Defense attorney Todd Melnik subpoenaed the Dodgers and Fox Networks, which owned the team then, to scan videotape of the televised baseball game and footage from its "Dodger Vision" cameras. Some of the videotapes showed where Catalan was sitting but Melnik couldn't make him out.

Melnik later learned that HBO had been at the stadium the night of the killing to tape an episode of "Curb Your Enthusiasm," a self-deprecating comedy starring "Seinfeld" co-creator Larry David. The lawyer found what he was looking for in footage that had not made the final cut.

"I got to one of the scenes, and there is my client sitting in a corner of the frame eating a hot dog with his daughter," Melnik said. "I nearly jumped out of my chair and said, 'There he is!"'

The tapes had time codes that allowed Melnik to find out exactly when Catalan was at the ballpark. Melnik also obtained cell phone records that placed his client near the stadium later that night, about 20 minutes before the murder.

The attorney said it would have been impossible for Catalan to get out of the parking lot, change vehicles and clothing and play with his daughter as well as kill Puebla during that span.

Catalan, who could have faced the death penalty had he been convicted of murder, was released in January because a judge ruled there was no evidence to try him.

"To hear the words from the judge's mouth, I just broke down in tears," Catalan, 26, said Tuesday. "It was the happiest moment in my life."

Catalan, raising his family and working with his father as a machinist, has submitted a claim against the city of Los Angeles, alleging false imprisonment, misconduct and defamation of character. Puebla's murder remains unsolved and the case against Catalan's brother, who is accused of being the driver in a drive-by shooting, is still pending.

Prosecutors and police did not return calls seeking comment Tuesday.

Other evidence also helped dismiss the case against Catalan, but the videotape "had extreme dramatic effect," Melnick said.

The show was hardly about the ballpark crowd that night. Its plot turned instead on a prostitute being hired - not for sex, but to be a passenger in a car so that the driver could qualify to travel in the carpool lane, avoiding the worst of baseball stadium traffic.

The LAPD said Puebla was shot outside her house by a suspect who witnesses described as "a medium build male Hispanic, 19-25 years of age, 5'8" to 5'10"."

"He had very short hair and a mustache and appeared to be a gang member," said a police statement.