BANGOR — A state prison inmate serving a 35-year sentence for murder was allowed to turn back the clock to change his plea and to receive a reduced sentence Friday.

Zachary Carr contended he didn’t understand the ramifications when he turned down a plea deal requiring him to serve seven years in prison. On Friday, a judge set aside the 24-year-old’s murder conviction, allowed him to plead guilty to manslaughter and reduced his sentence to 15 years in prison.

Assistant Attorney General Donald Macomber called the hearing unprecedented in his 27 years as a prosecutor but concluded that the result was as just “as we could’ve hoped for.”

Carr was 19 when he shot Bobby Surles in 2010 while he was lying unarmed on the ground after a confrontation between two groups in Bangor. He was sentenced in 2011.

During the hearing, Carr apologized to Surles’ family, but the family didn’t like the turn of events.

“My son did not get a second chance. Why should Mr. Carr? My son got a life sentence,” said Mary Ann Suddy, Surles’ grandmother, who had adopted and raised him.

The Maine Supreme Judicial Court upheld Carr’s conviction and sentence, but Justice Michaela Murphy was troubled about whether Carr’s lawyers adequately explained his options. By rejecting the plea deal, he opened himself up to the much harsher sentence after he was convicted of murder.

Macomber said he felt that Carr took a chance by rejecting the plea deal.

“He rolled his dice, and he didn’t like the outcome,” Macomber said. “Now he wanted another bite of the apple.”

But the judge saw things differently, and the two sides entered into negotiations. On Friday, the judge vacated the conviction and Carr pleaded guilty to manslaughter. Then the judge sentenced Carr under a new recommendation by Macomber and Carr’s new lawyer, Hunter Tzovarras.