In a case where a detective was accused of lying about the circumstances surrounding an arrest that turned up cocaine, the prosecution and defense are clashing over whether an official misconduct charge is valid.

New York City Police Detective Said Salim was indicted for his alleged intent to deprive an individual of the benefit of the “right to be free from the unreasonable search and seizure of his person,” but his attorney argues that prosecutors are misapplying the law.

Under Penal Law §195.00, official misconduct occurs when a public servant “with intent to obtain a benefit or deprive another person of a benefit … commits an act relating to his office but constituting an unauthorized exercise of his official functions, knowing that such act is unauthorized.”

Salim’s attorney, Mark Bederow of Bederow Miller, noted in court papers that a “benefit” is defined in Penal Law and jury instructions as “any gain or advantage.”

“A person who is at liberty and is then unlawfully detained by police is not deprived of a ‘gain or advantage;’ he is deprived of what he already had—his freedom and his civil rights. It defies common sense that maintaining one’s present condition of freedom is a ‘gain or advantage.’” Bederow said.

He insists that the prosecutors’ position contravenes legislators’ intent in crafting the statute.

But Manhattan Assistant District Attorney Ryan Connors responded that such an application of the charge was neither legally insufficient nor unprecedented.

“It is difficult to imagine a more fundamental benefit that the federal and New York constitutions afford than the limitations on the police’s arrest and search of a person,” he said in court papers.

The case, People v. Salim, 2004/2014, is before Acting Manhattan Supreme Court Justice Jill Konviser (See Profile).

The case is rooted in a July 2009 street encounter where Salim and colleagues, while conducting an unrelated investigation into illegal gun sales, arrested Wayne Davis and Jose Martinez for possessing more than two kilograms of cocaine. Prosecutors dismissed their cases in 2011.

Salim was indicted in April, being charged with offenses that include two counts of first-degree perjury, a D felony, and official misconduct, an A misdemeanor. In the indictment, prosecutors said Salim left his vehicle, stopped and searched Davis, and then searched the bag and found the narcotics.

But the government pointed to Salim’s testimony in which he said he initially mistook Davis for a confidential informant and then told the pair to leave the scene after realizing his mistake.

When telling them to leave, Salim said he told the men to take a bag he saw Martinez drop. Martinez said it was not his bag. Salim said he searched it, found the drugs and then arrested the two.

Defense court papers said prosecutors have offered the defense a chance to see a video documenting the encounter but have not turned over a copy.

Salim, 42, has been placed on modified duty and faces a maximum of seven years in prison on the top perjury counts. The penalty for the misconduct charge is up to a year in jail.

In May, Salim moved to dismiss the perjury counts, which he called “duplicitous and defective,” and asked the court to toss the official misconduct charge.

The defense argued that benefits could not be “remote, abstract or theoretical.” Besides, while Davis’ civil rights were arguably implicated, he was not “deprived of an advantage or increase from his pre-existent liberty.”

Bederow noted federal law, 18 U.S.C. §242, which outlaws the deprivation of rights under color of law and permits fines or imprisonment for breaches.

“If the state Legislature had intended to flood the criminal courts with criminal civil rights violations cases, it would have created a law which tracks 18 U.S.C. §242.”

But he said lawmakers took care to include the word “benefit” and define it as a “gain or advantage” so that an official misconduct charge was not used as a “general civil rights violation statute.”

The prosecution said the perjury charges were valid. As for the official misconduct charge, it pointed to case law saying the law was meant to “encompass flagrant and intentional abuse of authority by those empowered to enforce the law,”

Here, Connors said, Salim flagrantly abused his power, lacking probable cause when he executed the stop. The benefit did not have to be tangible and could range from avoiding ridicule to sexual gratification, he said.

Moreover, it was correct to characterize the right to be free from unreasonable search and seizure as a benefit, he said.

“Being free of unreasonable search and seizure is an advantage as it is a ‘circumstance of benefit to its possessor’, Connors said, quoting a dictionary definition of “advantage.”

Connors also said it was not relevant that Salim could be charged under the federal statute and noted at least one case where a public official was charged under the state official misconduct statute and the federal statute for the same act. He said lawmakers contemplated application of the statute in the civil rights context.

“The inclusion of the words ‘or deprive’ show that the legislature did purposefully criminalize actions of public officials when they intend to unlawfully deprive another person of an advantage which includes that person’s civil rights,” he said.

Bederow declined to comment, as did a spokeswoman for the Manhattan District Attorney’s Office.