BILLINGS, Mont. (AP) — A man has been sentenced to 40 years in prison for shooting at people in the streets of Billings and later at a state park in 2014.

The Billings Gazette reports ( ) that 53-year-old Kelly Dee Megard was sentenced Thursday. He pleaded guilty in August to felony assault with a weapon and four charges of felony criminal endangerment.

Prosecutors say Megard was under the influence of methamphetamine and believed people were trying to kill him when he followed a man while pointing a gun at him in July 2014. Later the same day he fired shots at a woman traveling with her two children in Billings before ramming her SUV with his car.

He was arrested while shooting at bushes and people in Pictograph Cave State Park.