A man who admitted using drugs as he moved from military life in Iraq to civilian life in Amherst was sentenced to more than 12 years in prison Monday in a federal weapons case linked to a string of suburban burglaries.

Local prosecutors say Jeffrey M. Zimmerman, 30, stole to support a heroin habit.

U.S. District Judge Richard J. Arcara sentenced Zimmerman to 12½ years in federal prison for possessing a weapon he stole during one of the burglaries last year.

After the federal sentencing, Zimmerman appeared before Erie County Judge Thomas P. Franczyk, who sentenced him to six to 12 years in prison for eight burglaries last November and December at businesses in Elma, Amherst, Alden and Akron. The judge ordered his sentence to run concurrently with the federal sentence.

Franczyk noted Zimmerman’s first drug use apparently occurred as he served in the Army.

“What happened to you?” he asked him. “Was it related to the military?”

Zimmerman said that after he left military service, he used drugs “to cope with the transition from being in a state of 100 percent adrenaline to returning to Amherst, the safest town in the country.”

Defense attorney Scott F. Riordan called it a tragic case of a man who served his country, became addicted to drugs and then committed burglaries to support his addiction. He described his client as one of the nicest, most polite people he has represented.

The string of burglaries prompted the federal court to deem Zimmerman a career criminal, resulting in a lengthy sentence on the charge of being a felon in possession of a firearm, Riordan said.

Zimmerman apologized to the burglary victims, who were not in court. “I hope they take comfort in the fact that these were crimes of opportunity,” Zimmerman told the judge. “I never intended to single anyone out.”

Assistant District Attorney Paul E. Bonanno told the judge that Zimmerman was a two-time felony offender who was convicted in October 2010 of attempted second-degree burglary and had pleaded guilty in May to eight counts of third-degree burglary.

Zimmerman, who lived in Amherst but later moved to Cheektowaga, was one of three men charged in the suburban break-ins.

Bonanno, who prosecuted the three men, said Zimmerman’s brother, Kevin J. Zimmerman, 24, of Ellen Drive, Cheektowaga, pleaded guilty in May to three counts of second-degree burglary and six counts of third-degree burglary for breaking into three homes in Amherst and Cheektowaga last December and six businesses in Amherst, Clarence, Alden, Akron, West Seneca and Elma between September 2012 and December.

Kevin Zimmerman faces up to 50 years in prison when sentenced in January, following sentencing in federal court on a weapons charge.

Alfred Tatman, 27, of Big Tree Road, Orchard Park, pleaded guilty in April to eight counts of third-degree burglary and was sentenced to three to nine years in prison.