A former South Carolina police officer who fatally shot an unarmed black motorist two years ago was sentenced Thursday to 20 years in federal prison.

A federal judge ordered the sentence for Michael Slager, a white 36-year-old formerly with the North Charleston police force who had pleaded guilty last year to a federal charge of violating the civil rights of Walter Scott by shooting him in the back after a traffic stop in April 2015. A cellphone video of the shooting showed Mr. Slager repeatedly firing his gun at Mr. Scott...