DENVER (Reuters) - A man who pleaded guilty to planting a bomb outside a Colorado police station to avenge the killing of his friend almost a half-century ago was sentenced on Friday to 27 years in prison, federal prosecutors said.David Michael Ansberry, 66, was sentenced in U.S. District Court in Denver for the botched bombing of the Nederland police station in 2016, a spokesman for U.S. Attorney Jason Dunn said.

The homemade device failed to explode despite repeated attempts by Ansberry to detonate it with a cell phone, according to an FBI arrest warrant affidavit.

Ansberry belonged to an itinerant hippie group known as “Serenity, Tranquility and Peace,” or STP, according to a memorandum filed by prosecutors ahead of Ansberry’s guilty plea in July 2017.

The group had a presence in Nederland, a mountain community about 15 miles west of Boulder, in the 1960s and 1970s. One of the group’s members, Guy Goughnor, was killed in Nederland in 1971, according to prosecutors.

“The Nederland town marshal, Renner Forbes, eventually confessed to killing Goughnor and was convicted for that crime in 1998,” federal prosecutors wrote in court documents. Forbes has since died.

Goughnor went by the nickname “Deputy Dawg” and a message was scrawled at the attempted bombing scene which read, “RIP Deputy Dawg and the date 7-17-71,” prosecutors said.

Authorities said Ansberry had harbored a grudge for more than four decades and traveled from California to Idaho, where he purchased bomb-making components before arriving in Colorado.

In October 2016, a Nederland police officer discovered a backpack containing a cell phone connected to a battery and a suspicious powder outside the town’s police station, prompting its evacuation and that of several nearby businesses.

Bomb squad technicians disarmed the device and no one was injured in the incident.

FBI agents were able to track the cell phone and obtained surveillance video of its purchase at a Colorado grocery store. Ansberry was easily identified as the buyer by his diminutive 3-foot, 6-inch stature.

Records also showed that Ansberry stayed at a Nederland motel the night of the attempted bombing. He was arrested at Midway Airport in Chicago as he was preparing to catch a flight to Baltimore.

He pleaded guilty in July 2017 to use and attempted use of a weapon of mass destruction.