A South Florida police officer has pleaded guilty to selling drugs illegally while in uniform and carrying his service weapon.

Court records show that 45-year-old Dewitt McDonald pleaded guilty in federal court last week. McDonald was an officer with the West Palm Beach Police Department.

McDonald was fired in August, after 18 years with the department. West Palm Beach Police Chief Vincent Demasi described a “pattern and practice of willfully disregarding” department policies as reason for dismissal.

During his time with the West Palm Beach Police Department, records indicate McDonald faced disciplinary action 45 times. During a five-year period prior to his termination, he received 21 letters of reprimand and 73 days of unpaid suspensions.

Authorities say McDonald also operated a pair of health and wellness clinics. Through these, he acknowledged illegally selling steroids and other prescription drugs.

McDonald also admitted in March that he delivered drugs to another police officer while carrying his weapon and on duty.

McDonald faces a sentence of between five years and life in prison.A Fort Lauderdale federal judge is scheduled to sentence him on July 18.