OAKLAND — A man who opened fire on three young Oakland children to avenge his friend’s death and killed an 8-year-old girl was sentenced to death on Wednesday in the first capital case in Alameda County in four years.

“I think the evidence is abundantly clear this defendant has no moral compass,” Judge Jeffery Horner said Wednesday morning at a sentencing hearing for Darnell Williams Jr., a 25-year-old from Oakland and Berkeley who has been in and out of the criminal justice system since he was a young child.

Williams did not show any emotional reaction and did not speak through the four-hour sentencing hearing largely attended by the family of Anthony Medearis, the 22-year-old Berkeley man he killed in 2013 eight weeks after he killed 8-year-old Alaysha Carradine.

Medearis’ aunt pumped her fist and other relatives quietly cheered when Judge Jeffrey Horner pronounced Williams’ death sentence. Alaysha’s mother did not attend; she told assistant district attorney John Brouhard that it would be too difficult.

“She was a truly an angel put on earth, such a beautiful girl with a radiant personality,” Alaysha’s mother, Chiquita Carradine, wrote in a letter read aloud in court. “Please give him the death penalty to stop him and men like him from taking our precious kids away.”

Judges have the power to reduce a death sentence to life in prison without the possibility of parole, but Horner said it is his independent determination that the death penalty is appropriate for Williams.

Williams’ attorneys argued to jurors that Williams “never had a chance” as the son of two neglectful parents who were incarcerated on and off throughout his childhood, Horner said. Williams was alternately raised by his grandfather and in the juvenile justice and foster care systems. He was nine when he committed his first burglary. He had been recently paroled from prison, for shooting at a man in Oakland, when he killed Alaysha.

It was right after his release that he promised his grandfather that he was going to turn his life around and stay away from firearms, Horner said.

“The truth is the defendant had many, many chances throughout his life,” the judge said. “He spurred and rejected them all, every single one of them.”

Horner described Williams on Wednesday as having an obsession with firearms, street justice, revenge and violence.

Incensed over a friend’s killing on July 17, 2013, a 22-year-old Williams grabbed two guns and a bulletproof vest to seek his revenge against the suspected killer by targeting the man’s children and their mother.

Those kids, a 7-year-old girl and a 5-year-old boy, were having a sleepover at their Wilson Avenue home with their grandmother and their friend Alaysha. Williams rang the doorbell with a gun pointed downward at the children’s level and waited. When the 7-year-old opened the door, he fired 13 rounds. Everyone was hit, but only Alaysha was killed.

An Oakland police officer’s personal recording device caught video of the chaotic aftermath of wounded children crying as the officer carried a dying Alaysha out of the apartment.

“Those images will perhaps stay with us forever. I know they will stay with me,” Horner said.

Williams shot and killed Medearis in the back as Medearis was running and begging for mercy on Sept. 8, 2013, during a dice game in Berkeley. He wanted Medearis dead because he thought he was a snitch, Horner said. Minutes before the shooting, he sent a text message to a friend saying he was about to rob Medearis.

That time Williams fired 16 shots. The first bullet fragmented and hit Williams’ 8-year-old nephew under his eye.

“Why did you do it; why did you do it?” Medearis’ mother and sister shouted over and over before being forced out of the courtroom. The women lost their composure after the court allowed them to play a recording of Medearis’ young son asking the same question.

The jury convicted Williams of two counts of first-degree murder and three counts of attempted murder and recommended a death sentence. The special allegations of murder by lying in wait and murder during a robbery, and the fact that multiple murders were committed, made Williams eligible for capital punishment.

The last death sentence handed down in Alameda County was to David Mills in 2012 for three murders he committed in 2005. Williams was the first person Alameda County sought the death penalty against since District Attorney Nancy O’Malley took office in 2011.

California hasn’t executed a condemned prisoner since 2006 as issues over capital punishment are litigated in the courts. Proposition 62 on the November ballot brings the question of whether to repeal the death penalty back to California voters.

Brouhard said the death penalty is a reserve for the “select few who commit the most horrific murders,” and Williams’ crimes were shocking.

“Shooting at Mr. Medearis while he was running away and begging for his life was vile. But when someone comes into our community and targets our children, the sense of injustice is intolerable,” Brouhard said. “Alaysha Carradine was not given the courtesy of laying down on a gurney, receiving anesthesia, and falling asleep before dying.

“Rather, she laid on a blood-soaked gurney, had her chest cut open and had her heart squeezed by hand in a futile attempt to prevent death at age 8 years old.”