GREENBELT, Md. (AP) – A former Maryland judge who ordered a defendant to be physically shocked in his courtroom was sentenced Thursday to participate in anger-management classes and pay a $5,000 fine.

Robert C. Nalley of La Plata, Maryland, will also have to spend a year on probation. Nalley, 72, pleaded guilty earlier this year to a civil rights violation for ordering a deputy to activate a “stun-cuff” that a defendant appearing before him was wearing around his ankle. The defendant, who was acting as his own lawyer, was before Nalley in July 2014 for jury selection and had failed to listen to Nalley’s orders to stop speaking.

After he was shocked, the defendant fell to the ground screaming. A video of the exchange without sound and separate audio was played in court Thursday. Prosecutor Kristi O’Malley noted that the defendant didn’t raise his voice or yell during the exchange and even called the judge “sir.”

She said Nalley “very quickly grew impatient” and that his use of the stun-cuff was “highly disproportionate” for “nothing more than verbal interruptions.”

“Our constitution does not allow a violation of rights based on annoyance,” she said.

Nalley acknowledged as part of a plea deal “that the use of the stun cuff was objectively unreasonable under the circumstances,” and both prosecutors and Nalley’s lawyer agreed to recommend a sentence of one year on probation.

“To say that I’m chagrinned to be standing here is an understatement,” Nalley said in a brief statement in federal court in Greenbelt on Thursday.

Nalley, who was a judge in Charles County from 1988 to September 2014, did not apologize in court but did say he had made an “error in judgment.” Nalley’s ability to hear cases was rescinded several months after the incident.

Judge William Connelly, who oversaw Nalley’s case, said in court that a year of probation was an appropriate sentence in part because of Nalley’s age and the fact he can no longer hear cases.

Also in court Thursday was the defendant Nalley ordered shocked, Saamir Jhaled Khaleel Kingali, who at the time he was before Nalley was charged with unlawful possession of a firearm. Kingali, 27, who is also referred to in court records as Delvon King, called Nalley’s actions “torture” and a “very dehumanizing experience” and walked out of the courtroom before Nalley was sentenced.

“There was no justice here today,” he said after the hearing, adding that he doesn’t believe Nalley is sorry for his actions.

The stun-cuff administered an electric shock for about five seconds. Kingali said the shock had impacted his ability to act as his own lawyer when his trial resumed.

Nalley’s lawyer, Robert Bonsib, noted in a court filing ahead of Thursday’s hearing that Kingali had a history of disruptive courtroom behavior, including previously running out of the courthouse. He said Nalley had been warned of Kingali’s disruptive behavior already on the day of the incident. And before Nalley ordered Kingali to stop speaking the two had also struggled over the name Kingali should be called in court. Bonsib also said Nalley had never been trained on the use of the stun-cuff.

This is not the first time Nalley has been a defendant. In 2010, he pleaded guilty to tampering with a vehicle after he deflated the tire of a cleaning woman’s car that was parked in a restricted zone at the courthouse. As a result, he was fined, had to write a letter of apology and was suspended for five days without pay.