A counterterrorism detective who says his failed drug test came because his wife had spiked his meatballs with marijuana has filed a lawsuit to get his job back.

Anthony Chiofalo asked the court to declare that his firing in August from the New York Police Department was unreasonable and unconstitutional, to declare that a damning hair sample was improperly taken and to order his rehiring with back pay plus interest, seniority and all benefits.

Chiofalo, a 22-year veteran assigned to the Joint Terrorism Task Force, was suspended without pay in November 2005 after a random drug test found marijuana in his system. He denied using drugs and demanded a hearing.

During an investigation, Chiofalo's wife, Catherine Chiofalo, said she secretly put enough marijuana for about six cigarettes in her meatball recipe in July 2005, hoping a failed blood test would force him to retire, court papers say.

Catherine Chiofalo, according to court papers, testified at the hearing that she "just wanted my husband not to die of a heart attack or get killed. I wanted him to be around to help raise my son."

The couple later took and passed lie-detector tests about how the marijuana was ingested, Anthony Chiofalo's court papers say.

Chiofalo says his wife had marijuana at home because she used it to relieve nausea caused by medications she took for back pain. He said he did not know where she got it.

An administrative judge recommended that Chiofalo be reinstated. But police Commissioner Raymond Kelly, who has the last word on firings, rejected the recommendation and fired Chiofalo.

A police department spokesman, John Kelly, said in an e-mailed comment on Chiofalo's firing, "The officer's excuse was not credible."