ALBUQUERQUE, N.M. (AP) – A 16-year-old charged with two other people in the beating deaths of two homeless Navajo men in New Mexico pleaded guilty Wednesday in a plea deal that offers the possibility of release when he turns 21.

The teen, whose name was not released because of his age, entered the plea in Albuquerque District Court to second-degree murder and related charges.

The deal also caps his potential sentence at a maximum of 20 years. Police say the teen was 15 at the time of the attack.

As part of the agreement, the teen agreed to testify against the other suspects at a trial scheduled to begin Oct. 20.

Prosecutors say the three teens killed Allison Gorman, 44, and Kee Thompson, 46, in July 2014. The teen who entered the plea told investigators that cinderblocks were among the things used to beat the men for over an hour.

Alex Rios, 19, and a 17-year-old juvenile are also facing murder charges.

The youthful offender law makes it possible for teens between 15 and 18 to be tried for first-degree murder and sentenced as adults if convicted. More protections are given to 14-year-olds.

Sentencing for the 16-year-old is scheduled for February to allow time to arrange expert testimony.