ROCHESTER, N.Y. — A teenager has been sentenced to 20 years in state prison for firing a gun at a Rochester police officer during a foot pursuit earlier this year.

The Monroe County District Attorney’s Office says 17-year-old Ernestiaze Moore was also sentenced Wednesday to five years post-release supervision for pleading guilty to attempted murder.

Authorities say Moore was 16 years old last Feb. 26 when officers responding to reports of shots fired encountered the teen in a neighborhood on the city’s northwest side.

Officials say as an officer approached Moore, he fired once at the officer from 10 feet away with a .380-caliber handgun. The officer wasn’t hit.

Moore was captured soon afterward. He pleaded guilty to the charges in July.