COLUMBIA, S.C. (AP) — A former South Carolina Highway Patrol trooper who shot an unarmed man during a traffic stop in 2014 was sentenced to more than three years in prison Tuesday.

Circuit Judge Casey Manning sentenced Sean Groubert to five years in prison and three years of probation for shooting Levar Jones in the hip after stopping him for a seat belt violation in Columbia.

Groubert, who is white, was given credit for 17 months he served after pleading guilty to aggravated assault and battery last year. Dashcam video shows Groubert shot Jones, who is black, as he reached into his truck to get his driver’s license after Groubert asked to see the license.

Groubert said he thought Jones was getting a gun and the officer feared for his life.

Groubert had been involved in a shootout in a chase in 2012. His lawyers said Tuesday that Groubert suffers from post-traumatic stress disorder because of that shooting.

The video showed Jones was being polite and was trying to comply with the officer’s commands when he was shot. The Highway Patrol fired Groubert shortly after Jones was shot.

Groubert apologized in court Tuesday.

“I made a horrible mistake the day I shot you and I owe you an apology and I deserve to be punished,” Groubert said directly to Jones. “You did nothing wrong and I screwed up, plain and simple. I pray for you every night.”

The officer said he had wanted to apologize to Jones for three years but complied with a court order that he have no contact with the victim.

Jones said in court Tuesday the shooting changed him.

He said he no longer trusts law enforcement officers, even black officers. He asked that Groubert be sentenced to the maximum 20 years in prison.