A Smithtown physician pleaded guilty Wednesday to six counts of illegally prescribing oxycodone to his patients and will serve more than 3 years in prison.

Dr. Mitchel Fagin, appearing in federal court in Central Islip before U.S. District Judge Joanna Seybert, said he “knowingly and intentionally distributed oxycodone . . . without legitimate medical reason” on a half-dozen occasions.

Fagin was arrested by agents with the federal Drug Enforcement Administration in May on charges of illegally prescribing narcotics and tranquilizers, including oxycodone and methadone, according to court papers.

StoryFeds: Doctor illegally prescribed drugsVideoWatch a video on the doctor's caseSee alsoNarcotics prescriptions by ZIP code

At the time, he pleaded not guilty to the charges and was released on $200,000 bond on condition he surrender his Drug Enforcement Administration license to prescribe narcotics and undergo drug testing.

His lawyer, Anthony Colleluori, said Wednesday: “We object to the government’s use of the law to prosecute somebody for what is at best malpractice.”

In some cases, Fagin traded prescriptions for controlled substances or the drugs themselves in return for sexual favors from female patients, according to a bail letter filed by Eastern District Assistant U.S. Attorney Lara Treinis Gatz.

advertisement | advertise on newsday

Federal officials did not mention the existence of any trading drugs for sexual favors in court.

This is not his first infraction: Fagin’s license was suspended by the state in 1983 for two years, Treinis Gatz wrote.

Between August 1982 and January 1983, several New York City hospitals “discovered that Fagin had diverted and self-administered opioid medication that was intended for patients,” Treinis Gatz wrote. “Moreover, staff at Stony Brook University Hospital also determined that Fagin was self-administering and abusing pain medication.”

In her bail letter, Treinis Gatz said that since his license was originally suspended in the 1980s, Fagin has had other drug-related problems. In 1993, he temporarily suspended his own medical license and entered a treatment program after investigators discovered he had become addicted to Vicodin — and obtained the pills by filling prescriptions he wrote for fictitious patients, she said.

Further, the prosecutor wrote, the Health Department found that Fagin had improperly prescribed narcotics to patients in 2004, 2011 and 2012.

With Jo Napolitano