Flanagan spent 29 years on the police force and retired in 2012 as second deputy commissioner. A judge had sentenced him to 60 days in jail and three months of community service after a jury found him guilty of two official misconduct charges and a conspiracy count.

The appellate court had stayed his sentence during his appeal.

Reacting to the decision, Nassau's acting District Attorney Madeline Singas said in a statement that public corruption "cannot be tolerated."

"We brought this case because nothing is more fundamental than equal treatment under the law," she said. "...When a police officer dishonors the badge by breaking the law, fair-minded people know that the law must apply equally to everyone and my office will hold them accountable."

Flanagan's attorney, Donna Aldea of Garden City, said Wednesday the defense now will ask the Court of Appeals in Albany to hear the case.

"We're disappointed in the decision, obviously," she said. "We continue to maintain that Bill did nothing wrong here."

Aldea said the defense also would ask the Albany court to stay Flanagan's sentence -- something the district attorney's office said it would oppose -- while a judge decides whether the higher court would hear the case or not.

"This won't be the first time that the Court of Appeals is relied upon to right a wrong that other courts have overlooked," Aldea added.

Prosecutors said Flanagan misused his position by conspiring to quash the felony arrest of high school student Zachary Parker as a favor to his father, Gary Parker, a longtime donor to police causes and a wealthy partner in a Manhattan accounting firm. The 2009 case involved the burglary of more than $10,000 in electronics from John F. Kennedy High School.

Prosecutors said Flanagan abused his authority to get police to return electronics Zachary Parker stole, and Gary Parker repaid him with steakhouse gift cards and a state-of-the-art flashlight.

Two other police officials pleaded guilty in connection with the same case. In 2013, retired Nassau Deputy Chief of Patrol John Hunter pleaded guilty to official misconduct. In 2014, retired Nassau Detective Sgt. Alan Sharpe pleaded guilty to official misconduct.

Aldea said in Flanagan's appeal that prejudicial evidence and improper arguments kept his trial from being fair.

But the Nassau district attorney's office told the appellate court Flanagan "crossed the line between discretion and corruption."