The man who barged into a nail salon and gunned down a 10-year-old boy during a robbery will spend the rest of his life behind bars in prison, a judge ruled Tuesday morning.

Anthawn Ragan Jr., 31, was shaking and moving his lips as he heard his sentence for the Nov. 22, 2013, murder of 10-year-old Aaron Vu at his parents’ Hong Kong Nails salon in northwest Miami-Dade. Ragan, who sat beside his attorney Adam Goodman, waived his right to a jury trial — an unusual move for a defendant facing execution.

Instead, Miami-Dade Circuit Court Judge Marisa Tinkler Mendez decided whether Ragan deserved life or death for the slaying, which galvanized many in South Florida.

Staring at Ragan, Tinkler Mendez said he was “undoubtably a danger to society,” but added that the totality of the circumstances did not warrant the death penalty. The judge pointed out Ragan’s well-documented history of mental and behavioral issues and learning disabilities.

“Although the three-week crime spree [that] culminated in death of Aaron Vu in the robbery of Hong Kong nail salon was horrific, this was [the] result of a seriously compromised and a neurologically impaired individual,” the judge said.

Several of Aaron’s loved ones wept as Tinkler Mendez meted out the sentence. About two dozen relatives and supporters, including customers of the nail salon, packed the right side of the courtroom on Tuesday.

After the sentencing, Aaron’s father Hai Nam Vu told reporters attending the proceeding was the hardest thing in his life — aside from losing his son.

“As long as he’s not out ever in public to hurt another innocent person, that’s the main thing I wanted,” Vu said.

During the trial, Vu recounted his terror when an ordinary Friday at his family-owned nail salon ended with Ragan and another man, who remains unidentified, gunning down Vu’s 10-year-old son as he watched.

After stealing more than $300 in cash and jewelry from customers and employees, the two gunmen were on their way out when one turned and fired twice inside the salon, hitting both Vu and Aaron. While Vu survived, Aaron, who loved Street Fighter action figures and Beats by Dre headphones, didn’t.

Vu said his family has been torn apart by Aaron’s murder, but Vu forgave Ragan in court because he said his son would have done so.

“Nothing is going to bring my son back…, but I’m thankful that at least he’ll be sent to prison where he’ll never hurt another innocent person again,” Vu said on the stand.

Tuesday was the second time Ragan was spared from the death penalty — also for an offense stemming from his 2013 crime wave.

Last year, a jury sentenced Ragan to a lifetime behind bars for the execution-style murder of Luis Miguel Perez, a small-time drug dealer, at a Miami motel. Tinkler Mendez presided over that case, too.

In recent months, two out of three Miami death penalty cases ended with the defendants being sentenced to life over death. Those cases were left to juries, which returned life verdicts.

Outside the courtroom, defense attorney Tony Moss said the life sentence was part of a “well-thought-out decision” by the judge.

“This was not a client deserving of the death penalty with… his neurological deficits,” Moss said.

During opening statements, Moss recounted Ragan’s broken upbringing: Ragan’s father was locked up for life after being convicted of murder while Ragan was still in his mother’s womb. (Moss defended Ragan’s father in a murder case in the 1990s.) Ragan was exposed to crime from an early age, and his family members were absent during his upbringing, many serving time for serious crimes, Moss said.

“What a life sentence can provide can be finality,” Moss said. “This will be the last court proceeding they will ever have to attend.”

Prosecutor Scott Warfman argued that the case warrants the death penalty despite the murder not being carried out in a heinous, atrocious or cruel manner — or being committed with heightened premeditation. The killing, Warfman added, shattered Aaron’s family.

“They [suffer] because of what Mr. Ragan has done,” Warfman said. “They were living their life until Mr. Ragan absolutely obliterated that life.”