Courtesy of KFMB-TV

A man who participated with a fellow gang member in a crime spree that included the near-fatal beating of an 18-year-old UC Berkeley student in San Diego was sentenced Friday to 170 years to life in state prison.

Terrence Lavar Jarvis, 29, was convicted in April of the attempted murder of Grant Richman, along with robbery, attempted robbery and shooting at an inhabited dwelling.

Superior Court Judge Jeffrey Fraser — noting Jarvis’ violent criminal record — told the defendant he intended to sentence him to the maximum term under the law.

“I am going to give you every day, every week, every month, every year that the law allows me to do to protect society,” Fraser told the defendant. “You can never again be a free man. There is no chance of you being rehabilitated.”

Fraser — fighting back tears — told Richman’s parents that he couldn’t imagine being informed by homicide detectives, as they were, that their son had been brutally attacked and probably wouldn’t live.

“You should be very proud of your son … very proud,” the judge said.

Dr. Peter Richman, a general surgeon at Providence Holy Cross Hospital in Mission Hills in the San Fernando Valley, called Jarvis a “sociopath.”

“I do not forgive him. My wife does not forgive him. My son and daughter do not forgive him,” the victim’s father said.

He said his son, now 21, has returned to school in Berkeley.

Before he was sentenced, Jarvis apologized to “all the families involved.”

Deputy District Attorney Christopher Lawson told jurors that Jarvis and David Daniel White went on the crime spree to benefit their gang.

Grant Richman was attacked at 12:35 a.m., shortly after arriving in San Diego to spend the night at a friend’s home. Doctors initially thought he wouldn’t survive, and Lawson today called it a “miracle” that he did. But for the defendant’s best efforts, “Grant Richman would be dead,” the prosecutor told the judge.

Lawson said Jarvis and White began their crime spree about 1 p.m. on Dec. 27, 2011, when they went with two other men to the Emerald Hills home of fellow gang member Kevin Foster to give him a “disciplinary beating” for refusing to follow a gang order.

At 11:37 p.m., a woman was robbed at gunpoint in Mountain View. About an hour later, the defendants tried to rob another woman on El Cajon Boulevard in Rolando, Lawson said.

Minutes later, Richman was attacked and robbed as he got out of his car in front of his friend’s house. He was bludgeoned in the head from behind with a double-barreled shotgun as he placed cupcakes on the roof of his car.

At 2:30 the following morning, 11 shots were fired at the house in Emerald Hills where the crime spree began, Lawson said.

The attempted robbery count stemmed from Jarvis’ May 12, 2011, attempt to rob a medical marijuana dispensary in La Mesa, during which his gun went off and narrowly missed a teenage girl. Jurors deadlocked on whether Jarvis pulled the trigger.

The other counts involved the crimes that the defendant committed with White, who pleaded guilty last year to premeditated attempted murder and was sentenced to 22 years and eight months to life in prison.