LINCOLN, Neb. (AP) — A Montana man dubbed the AK-47 bandit and accused of holding up banks in several states over a five-year period including in Mason City has been sentenced in a Nebraska federal court to 35 years in prison.

Richard Gathercole, of Roundup, Montana, received the maximum sentence Wednesday after pleading guilty in March to bank robbery. The 41-year-old Gathercole admitted during that plea hearing to using an AK-47 while robbing a Nebraska City bank in 2014. Gathercole also pleaded guilty to the 2017 carjacking of a farmer in Kansas that led to his arrest in Lexington, Nebraska.

As part of his plea deal, Gathercole won’t be prosecuted by other jurisdictions for other violent crimes, including shooting at a Kansas state trooper in 2017 and bank robberies in California, Idaho, and Washington state from 2012 to 2017, as well as the robbery of the Iowa Heartland Credit Union in Mason City in 2015.

Some of the crimes had passed the five-year federal statute of limitations.