Former Charles County Circuit Court judge Robert C. Nalley, right, with his lawyer, Robert C. Bonsib, outside the Federal Courthouse on March 31 in Greenbelt, Md. (Ruben Castaneda/For The Washington Post)

A former Maryland judge Thursday was sentenced to a year’s probation for ordering a Charles County sheriff’s deputy to administer an electrical shock to a defendant in his courtroom.

Robert C. Nalley, a former Circuit Court judge in Charles County, had pleaded guilty to a misdemeanor charge of violating the civil rights of the defendant, Delvon L. King, as King was about to be tried on a gun charge in 2014.

“To say that I’m chagrined to be standing here is an understatement,” Nalley said in brief remarks in U.S. District Court in Greenbelt. Nalley said he felt “deep regret” over his “error in judgment,” which he said reflected not just on himself but also on his family and the Charles County justice system. Nalley did not apologize to King, who was in the spectators’ gallery a few feet away, or make any reference to him.

King, 27, said in court that Nalley “tortured” him and deprived him of a fair trial. Nalley had a deputy shock King, who was representing himself, as he made what he believed was a legal argument during jury selection on July 23, 2014. King dropped to the ground when a 50,000-volt shock was administered through a Stun-Cuff attached to an ankle.

After paramedics determined that King was not seriously injured, Nalley continued jury selection. On Thursday, King told U.S. Magistrate Judge William G. Connelly that he was disoriented and fearful after being shocked and was not able to defend himself to the best of his ability.

During the sentencing hearing, federal prosecutors played a videotape of the incident and, separately, an audiotape. In the audiotape, King and Nalley briefly talk about what the judge should call the defendant, who considers himself a “sovereign citizen” and not subject to the government’s laws. They agree on a name, and as Nalley talks about the jury selection process, the defendant speaks over him, making what he believes is a legal point.

Nalley, his voice agitated, says, “Stop. Stop.” Then he says: “Mr. Sheriff, do it. Use it.”

King screams three times.

The videotape shows King calmly spread about a dozen stacks of paper on the defense table. Nalley takes the bench. Later, King drops to the ground, falling on his right side.

The incident occurred before prospective jurors were brought into the courtroom.

Nalley, 72, retired from the bench in September 2013. Court officials recalled him to preside over cases on a part-time basis.

About a month after the incident became public, in September 2014, the Maryland Court of Appeals, the state’s highest court, banned Nalley from the bench. The court did not state the reason, but said it had found “good cause” to take the action.

The civil rights violation was not the first time Nalley has run afoul of the law.

In August 2009, Nalley deflated the tire of a Toyota Corolla that was parked in a restricted area near the La Plata courthouse. Charles County sheriff’s deputies witnessed the incident, and one of them recorded it. The judge placed a pen or other sharp instrument into the tire’s valve to release the air.

Nalley considered the spot his; it turned out the car belonged to a member of the courthouse cleaning crew who parked there because she did not want to walk through the courthouse parking lot at night.

Two months later, Nalley pleaded guilty to tampering with a motor vehicle, a misdemeanor. A District Court judge ordered Nalley to pay a $500 fine and write a “heartfelt” letter of apology to the woman.

During Thursday’s sentencing, Connelly, the magistrate judge, also imposed a $5,000 fine and ordered Nalley to complete an anger-management program.

King said Connelly’s sentence — which was consistent with the plea agreement worked out by Nalley’s defense attorney, Robert C. Bonsib, and federal prosecutors — was too light.

“There was no justice here today,” he said.