AUGUSTA — A city man who spent six years in federal prison for armed robbery of a pharmacy a decade ago pleaded guilty Tuesday in Kennebec County Superior Court to charges that will send him back to jail for four years.

Zachary A. Gagnon, 32, admitted attacking a man with a hammer last summer in Augusta as well as possessing heroin when he was arrested on that charge Aug. 11 in Damariscotta Lake State Park.

Justice Michaela Murphy sentenced Gagnon to 10 years in prison, with all but four years suspended, and three years of probation.

The sentence handed down Tuesday will run concurrent to three years Gagnon will be spending in federal prison.

On Monday afternoon in U.S. District Court in Bangor, Judge George Z. Singal revoked the final 36 months of Gagnon’s supervised release. That supervised release was part of Gagnon’s 2002 sentence for armed robbery of a pharmacy, use of a firearm during the commission of a federal crime of violence and possession of Oxycontin with intent to distribute.

Gagnon was freed from federal prison in December 2008 after serving nearly six years of that eight-year sentence and began a five-year term of federal supervised release.

Gagnon was brought to state court in Augusta on Tuesday to resolve the outstanding state charges.

He pleaded guilty to aggravated assault in connection with the June 26 hammer attack on Brett Gray, who was sitting with a woman at a picnic table at College Carry-Out on Mount Vernon Avenue in Augusta.

Authorities at the time described the incident as a robbery and said the two men did not know one another.

A charge of robbery related to the attack was dismissed by the prosecution in exchange for the plea to aggravated assault.

Gray was injured but did not incur any medical bills as a result of the attack, Assistant District Attorney Brad Grant told Murphy. Grant said Gagnon’s identity was determined by tracing the the attacker’s car registration plate and showing a series of photos to the victim.

Gagnon also pleaded guilty to violating a condition of release that occurred that same day.

On Tuesday, Gagnon also pleaded guilty to a possession of heroin charge from Aug. 11 in Lincoln County and agreed to the forfeiture of $3,088 in cash he also had on him at the time. Assistant Attorney General Lisa Bogue told Murphy that authorities received a tip that Gagnon, who had both federal and state warrants out for his arrest, would be coming to the park.

They arrested him when he stepped out of the car, and he had heroin, suboxone and the cash on him, she said.

Gagnon, who had a shaved head and wore a two-piece bright orange jail uniform, said little in court Tuesday except “guilty” several times and he indicated that he understood he was waiving rights to grand jury review of the charges as well as his trial rights.

He consulted several times with his two defense attorneys, Thomas Dyhrberg, who represented him in both federal and state court, and William Baghdoyan, who represented Gagnon on several state charges.

Attorneys told Murphy that Gagnon will serve three years in federal prison followed by a year in state prison and then spend three years on probation.

Betty Adams — 621-5631

badams@centralmaine.com