The plea agreement reached with Matthew Gwyer in Cumberland County Unified Criminal Docket in Portland was announced by District Attorney Stephanie Anderson. Gwyer’s juvenile convictions are for elevated aggravated assault, burglary to a residence while possessing a firearm, and aggravated criminal mischief.

Gwyer was 17 when he broke into the home of Bruce and Amy Glidden and shot Bruce Glidden as Glidden slept in the basement. Glidden was wounded in the thigh and left hand, district attorney spokeswoman Tamara Getchell said in a press release.

Getchell said Gwyer was sentenced by Judge Peter Darvin to “a juvenile correctional facility for an indeterminate period not to exceed age 21, the maximum allowable by Maine law.”

In accepting the deal, Gwyer also pleaded guilty to an adult charge of Class B aggravated assault. He will not be sentenced until March 2019, and the charge could be reduced to Class D “if he complies with several specified conditions while under supervision of the juvenile justice system,” Getchell said.

“The court’s orders in this case, which blend elements of juvenile and criminal justice, allow Mr. Gwyer an opportunity to redeem himself,” Anderson said. “They also ensure that if he does not avail himself of rehabilitative services in the juvenile justice system, he will be held accountable in the adult criminal justice system.”