A 16-year-old charged with two others in the beating deaths of two homeless Navajo men in Albuquerque, New Mexico, has taken a plea deal.

The teen pleaded guilty Wednesday to second-degree murder and related charges in an agreement that caps his potential sentence at 20 years. However, the deal offers the possibility of release when the teen turns 21.

As part of the agreement, the teen agreed to testify against the other suspects next month. Police say the teen was 15 at the time of the attack.

Prosecutors say the three teens killed 44-year-old Allison Gorman and 46-year-old Kee Thompson in July 2014.

Police reported cinderblocks were among the things the 15-year-old said the trio used to beat the men for over an hour.

The Associated Press isn't identifying the teen because of his age.