BANGOR, Maine — A Sangerville man was sentenced Friday in U.S. District Court to 10 years in prison for the armed robbery of a Bingham pharmacy more than three years ago.

James Stile, 58, pleaded guilty Oct. 30 to one count of robbery of a controlled substance from a pharmacy. In exchange for his plea, one count each of use of a firearm in furtherance of a crime of violence, being a felon in possession of a firearm and ammunition, and manufacturing more than 100 marijuana plants was dismissed.

“I’m not the problem; addiction is the problem,” Stile told U.S. District Court John Woodcock at the seven-hour-long sentencing.

Stile said he took responsibility for the robbery and apologized to the victims. He asked Woodcock for leniency so that he could continue his work with Narcotics Anonymous and inform society about the ravages of addiction.

A native of Brooklyn, New York, Stile moved to Sangerville after Sept. 11, 2001, according to court documents. He raised, trained and showed German shepherds.

He dealt with a cocaine addiction in the 1980s, and by the time he moved to Maine, Stile was suffering from chronic pain due to a back injury. In March 2011, when Stile picked up his morphine prescription at a Bangor pharmacy “two men attacked and pistol whipped him repeatedly in the face, as they stole his medication,” defense attorney Peter Rodway wrote in his sentencing memorandum. Stile’s physician declined to refill the prescription for a month.

So, Stile bought methadone illegally to get him through, his attorney wrote. When he went back to his doctor, Stile tested positive for methadone and the physician dropped him as a patient.

Rodway said that Stile’s robbery of the pharmacy was “an impulsive act” fueled by the defendant’s pain, addiction and mental health issues.

Woodcock disagreed.

“This was extremely well planned,” the judge told Stile just before imposing the sentence. “The way it was executed was more like a robbery.”

In addition to prison time, Woodcock sentenced Stile to five years of supervised release. The judge also ordered Stile to pay nearly $13,307 in restitution for the drugs he stole.

By pleading guilty, Stile admitted that about 5:30 p.m. on Sept. 12, 2011, he entered the E.W. Moore pharmacy and pointed what appeared to be a sawed-off shotgun at the owner and three female employees behind the counter. When a customer entered the store, Stile ordered him to get behind the counter too, according to the prosecution version of events to which he pleaded guilty.

Stile demanded narcotics from the owner. As he was filling the black bag provided by Stile, the robber tied the hands and feet of the employees and the customer with zip ties, according to court documents. Once the owner had filled the bag, Stile zip-tied his hands and feet as well.

Stile stole nearly 100 bottles of prescription drugs, according to a previously published report.

“I think what you did was unspeakable,” Woodcock told Stile. “It was egregious. It merits a significant sentence.”

Stile has been held without bail since his arrest on Sept. 13, 2011. That time, which Rodway said totaled about 44 months, will count toward his sentence.

Rodway was the fifth attorney appointed to represent Stile, who had what Woodcock called “contentious relationships” with all his lawyers. Stile also filed more than 20 motions himself in the case.

Stile faced up to 25 years in federal prison and a $250,000 fine.

Under the prevailing federal sentencing guidelines, Stile faced between 9 and 11 years and three months in prison. Assistant U.S. Attorney Andrew McCormick recommended a sentence at the high end of the guideline range.

Rodway urged a sentence of four years.