The sentence of life in prison without parole for an armed white man who killed an unarmed black teenager during an argument over loud hip-hop music in Jacksonville, Fla., “demonstrates that our justice system works,” said Judge Russell Healey at a Friday hearing.

Earlier this year, another jury failed to reach consensus on whether Michael Dunn, a 40-something computer engineer, murdered 17-year-old Jordan Davis, resulting in a mistrial. That jury did agree that Dunn was guilty of attempted murder for continuing to shoot into a fleeing SUV full of people.

The shooting fueled an ongoing debate over a new breed of self-defense laws, adopted in nearly half of all US states, which make it easier for armed individuals to kill in self-defense in public places.

Florida was the first state to make that change in 2005, and the killing of Trayvon Martin in 2012 was the most famous test of that law. The unarmed teenager was shot and killed after being pursued in the dark by a neighborhood watch captain named George Zimmerman. In that case, the judge instructed the jury that, under the law, someone who reasonably believes their life is at stake doesn’t have to retreat from a situation before retaliating with deadly force.

Judge Healey cited Florida’s stand your ground law in his sentencing Friday, saying the measure has been misunderstood and suggesting that Dunn’s actions “exemplifies that our society seems to have lost its way. … We should remember that there’s nothing wrong with retreating and deescalating the situation.”

Mr. Zimmerman was acquitted in 2013, based on the fact that Martin punched Zimmerman after being pursued. The verdict sparked protests and attempts to change the stand your ground laws, which so far have proved unsuccessful. But the decision in the Dunn case, at least to some legal experts, suggests that Americans more broadly may be eyeing the implications of the laws more deeply.

Dunn’s guilty verdict and sentence of life in prison also comes a month after a tearful judge sentenced Detroit resident Theodore Wafer to at least 17 years in prison for shooting an unarmed black teenager, Renisha McBride, who had banged on his door in the early morning hours. Mr. Wafer said in his defense that he was scared for his life before firing through a screen door, killing Ms. McBride.

“An unjustified fear is never an excuse to take someone's life,” Judge Dana Hathaway said in that September sentencing.

The stakes were even higher in the Dunn case, given the earlier mistrial on murder charges and Florida’s stature as a pro-gun, pro-self defense state, argues Donald Jones, a law professor at the University of Miami.

Professor Jones says that the ruling also fits into a broader cultural debate about the worth of young black men, an issue that has exploded into rowdy protests in Ferguson, Mo., after the police shooting of teenager Michael Brown on Aug. 9.

“I think, had Michael Dunn been acquitted, it would have sent a signal to other people that it’s hunting season, that society will not take seriously and will not value the lives of certain kinds of blacks,” says Jones. In that way, he says, the verdict and lifetime sentence was “necessary in terms of a social catharsis. I think the signal the criminal justice system sends was polluted by the first verdict and was cleansed by the second. Sanity is creeping in.”

Throughout the trial, Dunn maintained that the shooting was justified self-defense because he saw Jordan reach for a weapon in the back seat of the SUV. Police never found a gun. Dunn also didn’t called police after killing the teen. Instead, he returned to his hotel, ordered a pizza, then went for a walk with his dog before falling asleep.

In his defense, Dunn for the first time apologized to Jordan’s family, saying, "I want the Davis family to know I truly regret what happened. … I did what I thought I had to do. Still, I am mortified I took a life, whether it was justified or not."

One legal expert looked past what he called “the hoopla” around the Dunn case and suggests the jury simply zeroed in on the facts of the shooting.

“To me, it’s just an ordinary homicide case: There’s reasons people do things and then there’s excuses they give for doing them, and sometimes those are very, very far apart,” says Bob Dekle, a law professor at the University of Florida. “If you get in an argument over loud music and wind up shooting somebody to death, that’s pretty well inexplicable on a rational analysis of the situation.”