Michael T. Slager, the white police officer whose video-recorded killing of an unarmed black motorist in North Charleston, S.C., starkly illustrated the turmoil over racial bias in American policing, was sentenced on Thursday to 20 years in prison, after the judge in the case said he viewed the shooting as a murder.

The sentence, which was within the range of federal guidelines, was pronounced in Federal District Court in Charleston about seven months after Mr. Slager pleaded guilty to violating the civil rights of Walter L. Scott when he shot and killed him in April 2015. The case against Mr. Slager is one of the few instances in which a police officer has been prosecuted for an on-duty shooting.

“We have to get this type of justice, because being a police officer is one of the most powerful jobs in the country, and it should be respected,” L. Chris Stewart, a lawyer for Mr. Scott’s family, said after the hearing, which was punctuated by tears and grief. “But that doesn’t mean you’re above the law. That doesn’t mean you can do as you please.”