Get breaking news alerts and special reports. The news and stories that matter, delivered weekday mornings.

CHARLESTON, S.C. — More than two years ago, the fatal shooting of Walter Scott, an unarmed black motorist, by a white South Carolina police officer set off a wave of national protests over racially biased policing and the use of lethal force.

On Thursday, Michael Slager, who was fired as a North Charleston patrolman days after the shooting, was sentenced to 20 years behind bars after pleading guilty in Scott's death.

U.S. District Judge David Norton, in issuing the sentence, said Slager shot Scott with "malice and recklessness" and then gave false testimony to investigators. Norton ruled that Slager, 36, was guilty of second-degree murder and obstruction of justice, and he also sentenced Slager to two years of supervision after his release.

Scott's mother, Judy, was one of seven family members who spoke before the sentencing. She recalled her 50-year-old son growing up as a "happy, jolly child" and then turned to Slager directly, telling him, "I forgive you."

Slager began to cry.

Related:Walter Scott’s son makes emotional plea for justice at Slager sentencing

The Morning Rundown Get a head start on the morning's top stories. This site is protected by recaptcha

In his final statement before sentencing, the ex-officer said: "I wish I could go back in time and change the events. But I can't. It's a very tragic situation. I'm standing before the Scott family and the court and taking responsibility for the actions of April 4, 2015."

Federal prosecutors had sought life in prison for Slager, who agreed to plead guilty in May to a federal charge of violating Scott's civil rights. That was in exchange for state prosecutors' dropping their case after a month-long murder trial ended in a hung jury a year ago. In that trial, Slager had faced 30 years to life in prison if convicted.

Michael Slager, right, walks from the Charleston County Courthouse under the protection of Charleston County sheriff's deputies after a mistrial in December 2016. Mic Smith / AP file

Slager's sentencing capped a winding case that followed other notable police-involved deaths in Ferguson, Missouri; Cleveland; and New York, and it highlighted how rare it is for law enforcement officers to be convicted or to plead guilty in such incidents. A bystander captured the shooting of Scott on his cellphone, and the graphic video, which was viewed by the public millions of times, became a key piece of evidence for the prosecution.

Scott, a father of four children, was stopped by Slager for a broken taillight. The cellphone video began recording after the stop, when the men were standing in a vacant lot.

Related: It's very difficult to convict officers in police shootings, experts say

Slager fired eight shots at Scott as he ran away, striking him five times, including three in the back, a coroner later said. Even after he was shot, Slager handcuffed Scott's arms behind his back.

Slager had claimed that Scott took control of his Taser and that he feared for his life in a scuffle after the traffic stop. The video didn't show Scott taking the stun gun.

A co-worker of Scott's who was riding with Slager when he was pulled over told jurors that he didn't know why Scott ran. But Scott's family has suggested that it was because he owed back child-support payments and didn't want to be arrested.

Judy Scott smiles as she holds a photo of Walter Scott, her son, after former police officer Michael Slager was sentenced to 20 years in prison in federal court in Charleston, South Carolina, on Thursday. Randall Hill / Reuters

While prosecutors acknowledged during the trial last year that Scott wouldn't have been shot if he hadn't resisted in the first place, they said that that Slager had been trained against using lethal force in such a situation and had gooe too far. A jury of 11 white people and one black man — the foreman, Dorsey Montgomery II — couldn't agree on a verdict.

Montgomery later told "Today" that one other juror refused to convict the officer, while several remained on the fence. He said that while "race will always be a factor," he didn't believe it played into the decision for "the majority" of the jurors.

Slager has remained jailed since pleading guilty to the civil rights violation in May. While awaiting trial, he was housed in a cellblock next to Dylann Roof, who was sentenced to death in January for the 2015 Charleston church shooting.

In the months after Scott's death, the community demanded reforms in the North Charleston Police Department and a broader civil rights investigation. The U.S. Justice Department began a review of police policies and recommendations within the department, but it never finished as expected — disappointing some community members, The Associated Press reported.

At a news conference following the sentencing, Scott's brother, Rodney, said the family was pleased that "we got justice."

Their attorney, L. Chris Stewart, added that the judge's ruling showed that accountability can happen.

"Being a police officer is one of the most powerful jobs in the country, and you should be respected, but it doesn't mean you're above the law," Stewart said, adding that "the death of Walter Scott ... can make the next officer think one second longer before pulling that trigger."

Matthew Vann reported from Charleston. Erik Ortiz reported from New York.