By AARON KATERSKY, ABC News

(NEW YORK) — A Long Island, New York, doctor who is also a legislator and minister, was arrested while attempting to exchange oxycodone for sex, according to law enforcement officials.

Dr. William Spencer was taken into custody in a parking lot in Elwood. He appeared for his arraignment on Wednesday at the Central Islip courthouse via video conference, his hands cuffed behind his back, leaning forward while wearing  a blue shirt sleeve prison shirt and mask.

He was released without bail on his own recognizance. In agreement for release, Spencer was ordered to surrender his passport, his pistol license — he has a pistol permit but not a licence to carry, according to authorities — as well as any other firearms he may have by Thursday.

Spencer is being charged with criminal possession and sale in the third degree, according to Assistant District Attorney Kevin Ward.

According to Ward, Spencer made “oral admissions” to officers that there is an ongoing investigation into his past conduct which will involve additional search warrant and evidence recovered from his cellphone.

“Dr. Spencer has dedicated his life to his community, family and his patients,” said Spencer’s attorney.

The Suffolk County district attorney, along with Nassau and Suffolk police, the sheriff’s office, and federal officials with the Drug Enforcement Administration, will hold an upcoming news conference to discuss the arrest.

Spencer, of Centerport, was allegedly under the presumption he would be meeting a prostitute in a parking lot to trade the oxycodone pills for sex — but it was a sting operation.

He was in an official Suffolk County vehicle at the time of the arrest.

Spencer is a well-known doctor who has been a legislator in Suffolk County’s 18th District since 2011 and serves on an opioid task force. A pediatric surgeon, he was reported as the first doctor to serve on the Suffolk County Legislature in its 50-year history, according to Smithtown Matters. He is the chief of otolaryngology at Huntington Hospital and an associate clinical professor at Stony Brook University Hospital, according to his biography on the Suffolk County Legislature’s website.

Copyright © 2020, ABC Audio. All rights reserved.