A former South Carolina police officer has been sentenced to 20 years in prison for fatally shooting an unarmed African-American motorist.

Michael Slager committed second-degree murder when he shot Walter Scott, 50, in the back as he fled arrest after a traffic stop, a judge ruled.

"I forgive you," relatives of Scott told Slager, 36, in court, as they spoke about the death's impact on them.

A bystander recorded mobile phone video of the April 2015 shooting.

Experts say that without a video of the shooting, the former officer probably would not have been fired from the force nor have faced murder charges.

Video caption The dash cam footage shows Walter Scott's car being pulled over and Officer Michael Slager asking for his paperwork before Mr Scott runs away

Judge David Norton told the court that Slager, who is white, had "lived a spotless life" before the shooting.

"Regardless, this is a tragedy that shouldn't have happened," he added.

Lawyers for Slager had argued in court that he opened fire on Scott because he thought he had taken his police-issued stun gun during their scuffle.

The case ended in a mistrial in 2016, and rather than face another jury, the former North Charleston officer pleaded guilty in May to a federal charge of violating the victim's civil rights.

Image copyright Reuters Image caption The dead man's mother, Judy Scott, forgave Slager in court

In Thursday's sentencing, the judge ruled that Slager had acted with malice and "willful intent to provide false testimony".

The judge also had the option of sentencing him for a lesser crime of voluntary manslaughter, which would have carried a sentence of 12 to 15 years.

The dead man's mother, Judy Scott, told Slager in court on Thursday that she forgave him.

She said she hoped he would repent and allow Jesus into his heart.

Scott's brother, Anthony, said it had taken him a long time to overcome his depression and forgive Slager.

Image copyright Reuters Image caption Michael Slager gestures as he testifies in his murder trial last year

"I'm not angry at you, Michael," he told Slager. "I pray for you."

Members of the family thanked onlooker Feidin Santana for filming the encounter.

The City of North Charleston paid a $6.5m (£4.8m) settlement to the Scotts.

Slager told the court on Thursday: "I wish this never would have happened.

"I wish I could go back and change events, but I can't and I am very sorry for that."

Slager chased Scott after pulling him over for a broken brake light.

Scott, who was wanted for unpaid child support, fled the vehicle, police dashcam footage shows.

Video caption Racism in the US: Is there a single step that can bring equality?

A bystander's video captured Scott breaking free from Slager's grasp and running directly away from him, with his back to the officer.

Slager draws his pistol and fires from about 15ft (4.5m) away, hitting Scott five times.

The death took place amid US media scrutiny of police treatment of African Americans, and provoked protests by the Black Lives Matter movement.

US Attorney General Jeff Sessions said in a statement: "Officers who violate anyone's rights also violate their oaths of honour.

"And they tarnish the names of the vast majority of officers, who do incredible work."