MADISON--A Janesville doctor pleaded guilty in federal court Tuesday to one count of obtaining a prescription drug by fraud, according to the U.S. Attorney's Office.

Dr. Richard N. Barney, 53, Janesville, had faced 15 counts of obtaining prescription drugs by fraud. Federal prosecutors say he acquired Percocet by sending prescriptions to an InstyMeds machine at Beloit Memorial Hospital in the names of 15 patients without the patients' knowledge between January and October of 2012.

As part of a plea agreement, Barney pleaded guilty to one of the 15 counts. He admitted obtaining Percocet illegally Jan. 13, 2012, said Myra Longfield, spokeswoman for the U.S. Attorney's Office in Madison.

Percocet contains acetaminophen and oxycodone and is administered to relieve moderate to severe pain.

When Barney wanted to get painkillers, he wrote out prescriptions in the names of patients and picked up the drugs for himself, according to the indictment.

Barney will face a maximum of four years in prison when he is sentenced at 1 p.m. Thursday, March 6.

Assistant U.S. Attorney Elizabeth Altman, who is prosecutor for the case, said earlier that the InstyMeds prescription machines are relatively new technology, and she was unaware of any other cases in federal court for the Western District of Wisconsin involving them.

ATM-style prescription dispensing machines such as InstyMeds were designed to address the shortage of pharmacists and drug stores closing in small towns.

The point-of-sale machines generally are used by outpatients. The machines can be located in hospital lobbies, where they are accessible 24 hours a day.