A former judge in Maryland has been sentenced after facing a civil rights violation for ordering a defendant in his courtroom to be shocked.

Robert C. Nalley, 72, was fined $5,000 and will be required to attend anger-management classes. He also will be on probation for one year.

In July 2014, defendant Saamir Jhaled Khaleel Kingali was appearing before the judge on an unlawful possession of a firearm charge. After Kingali refused to obey the judge’s orders to stop speaking, Nalley ordered a deputy to activate the stun cuff Kingali was wearing. The courtroom video footage shows Kingali falling to the ground, where he can be seen writhing and screaming.

As part of the plea deal, Nalley admitted “that the use of the stun cuff was objectively unreasonable under the circumstances." He did not apologize for his actions during his Thursday court appearance, but did admit to making an “error in judgment.”

According to The Associated Press, Nalley served as a judge from 1988 to 2014.

The Associated Press contributed to this report.