In a speech that lasted almost 30 minutes, Judge Vonda Evans of Detroit laid into 47-year-old William Melendez, the former Inkster, Michigan, police officer caught on video beating an unarmed black man in January 2015.

Melendez was sentenced to 13 months to 10 years in prison Tuesday for his role in the attack on Floyd Dent, a 58-year-old black auto worker, that occurred during a late night traffic stop in the struggling Wayne County suburb last winter.

"The one image [from this trial] that stood out to the court was looking at Mr. Dent in his cell, shaking his head in disbelief of what had occurred to him," Evans said in a courtroom video published by local television station WJBK.

"If his conduct was indicative of what he was thinking, I would have thought this: 'What crime did I commit, being a black man in a Cadillac, stopped for a minor traffic offense by a group of racist police officers looking to do a nigger?'"

On Jan. 28, 2015, Melendez and his partner, John Zieleniewski, pulled Dent over for an alleged traffic violation. Upon finding that Dent was driving with a suspended license, the officers dragged him from his vehicle and onto the ground, where Melendez placed him in a chokehold and punched him 16 times in the head.

At least eight more Inkster police officers gathered at the scene, none of whom intervened to stop the attack. Dent was charged with resisting arrest and drug possession, the latter due to a baggy of cocaine that he alleged the officers planted on him.

The beating — which left Dent's face and shirt drenched in blood — was captured on a patrol car dashboard camera and went public soon after, prompting a criminal investigation. After his arrest, as he sat in a cell nearby, Dent reportedly had to listen and watch as officers made fun of him and cleaned his blood off their uniforms with disinfectant.

"If we don't invest in our police officers, we're going to see more incidents like the one that I'm presiding over today." — Judge Vonda Evans

Story continues

All charges against Dent were eventually dropped, and in May, he settled with the city of Inkster for $1.4 million.

Evans said her protracted speech by saying she wanted to give Melendez the "fairness and due process" he did not give his victim that night. She acknowledged the unique challenges that face police officers day to day, including high divorce, alcoholism and suicide rates, low pay and the persistent scrutiny of a public that often looks on them with hostility.

But she also criticized America's collective failure to properly train them, wondering aloud how far the money given to Dent in the settlement might have gone instead toward better police training. "If we don't invest in our police officers, we're going to see more incidents like the one that I'm presiding over today," Evans said.

It's questionable whether training would have done much good in this case. According to the Guardian, Melendez had long ago earned a reputation as one of the more volatile and violent police officers in the state of Michigan. He's been named a defendant in more than 12 federal lawsuits, "accusing him of planting evidence, wrongfully killing civilians, falsifying police reports and conducting illegal arrests," the report said.

"At least give me the satisfaction of knowing you're out there beating up niggers right now." — Text sent in March by then-Officer William Melendez

At one point during his 16-year tenure with Detroit police from 1993 to 2009, he received more civilian complaints than any other officer in the department. His fellow police nicknamed him "RoboCop" — a nod to the fictional cyborg police officer known for his merciless violence against criminals.

Tuesday marked the first time Melendez faced a jail sentence for any of his alleged crimes. The rest of the cases against him were either thrown out or settled out of court.

In one damning moment from the trial, Melendez and his partner were also revealed to have exchanged racist text messages a few months after attacking Dent. "At least give me the satisfaction of knowing you're out there beating up niggers right now," Melendez texted Zieleniewski in March, the Guardian reports.

"[Lol], just got done with one," Zieleniewski responded.

None of this was lost on Evans, who repeatedly emphasized the role of racism in the case in no uncertain terms. According to reports, Evans is known for her "unconventional" courtroom style, exemplified by her proclivity for fitted courtroom garb and a tendency to shout at defendants.

At a time when police violence in black communities like Inkster — which is 73% black — is sparking protests across the country, it's hard to imagine a more fitting admonishment than that delivered by Evans on Tuesday.

Or, as she put it so succinctly: "2015 ... how does this happen?"

Watch an excerpt of Evans' sentencing speech here:

Watch the whole sentencing video here. Evans' speech begins around 4:06:18: