A Long Island private investigator was charged Wednesday with paying off an NYPD cop to illegally get information on witnesses from a confidential federal crime database.

Private eye Joseph Dwyer, 46, of Shoreham, who worked for court-appointed defense lawyers in federal court in Manhattan, allegedly paid at least $9,000 in bribes to NYPD Sgt. Ronald Buell, 48, of Kings Park, to illegally access data on 45 people.

"Investigators assisting criminal defendants can -- and should -- do many things to serve their clients, but bribing law enforcement officials for confidential data is not one of them," said U.S. Attorney Preet Bharara in a statement.

Steve Zissou, an attorney for Dwyer, said, "Mr. Dwyer is not guilty of the charges."

A lawyer for Buell, who retired from the NYPD in February, had no comment.

The government said it was tipped off to the case in 2013 when Dwyer questioned two eyewitnesses in a homicide case whose names had been kept confidential, and a records check showed that Buell had queried the criminal database about one of the two.

Prosecutors said Dwyer bribed Buell to use his NYPD status to get confidential information on 22 different cases in federal courts in Brooklyn and Manhattan in which Dwyer was working as a defense investigator, and made at least 17 payments to Buell.

Dwyer, according to the complaint in Manhattan federal court, was himself an ex-cop and worked for Investigative Resource Group of Shoreham, a family company where his wife served as president and he was treasurer.

Prosecutors also said that Dwyer -- who was paid taxpayer money for services to poor defendants -- submitted $95-an-hour invoices for "purported investigative work" developing information on witnesses that he had actually gotten by bribing Buell.

Investigative Resource Group billed the federal government for more than $500,000 for services performed by Dwyer between 2011 and 2013, the criminal complaint said.

Dwyer and Buell were both released on unsecured bonds after brief court appearances Wednesday. Dwyer faces up to 45 years in prison. Buell faces up to 25 years in prison.

Trump on trial … Amityville school to stay open … FeedMe: Pizzeria Undici Credit: Newsday

Gilgo Beach search latest ... Tax breaks for manufacturer... Knicks playoffs ... Islanders vs. 'Canes, Game 3

Trump on trial … Amityville school to stay open … FeedMe: Pizzeria Undici Credit: Newsday

Gilgo Beach search latest ... Tax breaks for manufacturer... Knicks playoffs ... Islanders vs. 'Canes, Game 3

Latest videos

Newsday LogoSUBSCRIBEUnlimited Digital AccessOnly 25¢for 5 months
ACT NOWSALE ENDS SOON | CANCEL ANYTIME