PORTLAND, Maine (AP) — John Williams has been sentenced to life in prison for what a prosecutor described as the "execution" of a sheriff's deputy in Maine.

A judge imposed the maximum sentence Thursday on John Williams for the fatal shooting of Cpl. Eugene "Gene" Cole last year in Norridgewock. The 61-year-old Cole became the first police officer to be killed in the line of duty in nearly 30 years in Maine.

The 31-year-old Williams apologized and said he'd panicked.

Cole's killing prompted a massive manhunt with more than 200 law enforcement officers pouring into central Maine.

Prosecutors say Williams was angry over his girlfriend's arrest and wanted to avoid going to jail himself when he shot Cole on April 25, 2018. The defense said Williams was sleep-deprived and strung out on cocaine and heroin.