Former South Carolina police officer Michael Slager has pleaded guilty of shooting a black man. The ex-officer could face years of jail despite the state dropping the murder charge in an agreement.

Slager was accused of murder after shooting Walter Scott several times in the back as the 50-year-old motorist fled from the officer in April 2015 after a traffic stop. The shooting in Charleston was caught on video by a passer-by and quickly went viral. Slager was fired soon after the incident came to light.

The ex-officer had earlier claimed that he had used the firearm in defence. "I was scared," he said during the earlier trial, claiming he felt "total fear that Mr Scott was coming toward me". However, video of the incident appeared to offer a complete contradictory version of the event.

On Tuesday, 2 May, Slager pleaded guilty of violating Scott's civil rights. He entered the plea in front of his family, Scott's relatives and nearly 50 people who were present in the court.

Under the plea, the former officer, who is white, admitted of violating the civil rights of the black man and killing him while on duty. He also accepted to denial of rights under the colour of law, lying to state investigators, and using a gun in a violent crime.

According to the agreement, prosecutors will ask the court to apply sentencing guidelines for a second-degree murder, CNN reports.

"The defendant acknowledges that during the time he used deadly force, he knew that the use of deadly force was unnecessary and excessive, and therefore unreasonable under the circumstances," the plea deal said.

"Today is a victory for Walter. We got justice," Judy Scott, Walter Scott's mother, said and also added that she has forgiven Slager for his crime.

Walter Scott shooting
Judy Scott (R) and her son Rodney Scott, mother and brother of Walter Scott, react during a news conference after the guilty plea to federal civil rights charges by former North Charleston police officer Michael Slager in Charleston, South Carolina on 2 May, 2017 REUTERS/Randall Hill

While, Andy Savage, a lawyer for Slager, said: "We hope that Michael's acceptance of responsibility will help the Scott family as they continue to grieve their loss."

The plea deal does not carry any specific punishment, so Slager could face no prison or life behind bars. The plea also does not refer to Scott's race, the BBC reported.

A judge had earlier declared a mistrial in the case after the jury said it could not come to a unanimous decision.

According to reports, the jury had three options in order to avoid a mistrial: a guilty verdict for murder; guilty of voluntary manslaughter; or an acquittal. However, jurors struggled to reach a decision.