BOSTON — A bill that would allow parole for juveniles convicted of first-degree murder was approved by the Massachusetts House on Wednesday.

Under the measure, which passed on a 127-16 vote, people convicted of first-degree murder for crimes that occurred while they were between the ages of 14 and 18 could be eligible for parole after serving 20 to 25 years in prison.

For crimes that were deemed to involve deliberate premeditated malice or extreme atrocity or cruelty, the wait would be 25 to 30 years.

First-degree murder carries an automatic sentence of life in prison without parole in Massachusetts, but the state’s highest court ruled last year that it was unconstitutional to deny the possibility of parole to juveniles who were convicted of murder.

During Wednesday’s vote, the House rejected Republican-sponsored amendments that would have required somewhat longer stays in prison before people would become eligible for parole.

House Speaker Robert DeLeo said the bill will help ensure public safety.

“The House felt it was necessary to create a strong framework for protecting our residents while accounting for the special circumstances associated with juvenile offenders,” the Winthrop Democrat said.

Not everyone agreed.

Nancy Scannell of the Massachusetts Society for Prevention of Cruelty to Children said the bill undermines the court by “creating de facto life sentences” in part by “increasing the wait for a second hearing to 10 years.”

“The (court) struck down juvenile life without parole based in large part on internationally accepted science which has proven that a child’s brain is different from an adult’s and is not fully developed until his mid-20s,” Scannell said. “The court called for juveniles to have a meaningful chance at earning parole as a result. This legislation is not in keeping with that intent.”

Relatives of several murder victims attended a Statehouse hearing last month in support of a bill that would have required a significantly longer period, 35 years, before parole could be granted.

The bill now heads to the Massachusetts Senate.

The state’s parole board has already begun hearings for some of the 63 prisoners serving life without parole in Massachusetts under a juvenile sentencing law that carried a mandatory life sentence for first-degree murder.

In December, the state Supreme Judicial Court found that law unconstitutional, following a landmark 2012 U.S. Supreme Court ruling that struck down such mandatory life sentencing laws.

This month, the board approved parole for Frederick Christian, 37, who has been imprisoned since age 17 for his role in a deadly robbery in 1994.

In its ruling, the Parole Board cited his age at the time of the crime, his clean prison record and his testimony at a hearing.