“Mandatory life without parole for a juvenile precludes consideration of his chronological age and its hallmark features — among them, immaturity, impetuosity, and failure to appreciate risks and consequences,” Justice Kagan added. “It prevents taking into account the family and home environment that surrounds him — and from which he cannot usually extricate himself — no matter how brutal or dysfunctional.”

Bryan Stevenson, executive director of the Equal Justice Initiative, a nonprofit law firm in Alabama that represented the defendants in the ruling, called it “an important win for children.”

“Today’s decision requires the lower courts to conduct new sentencing hearings where judges will have to consider children’s individual character and life circumstances, including age, as well as the circumstances of the crime,” he said. But he added that the resentencing must be initiated by the inmates, that many lacked the resources to pay for a lawyer, and that the Supreme Court had said prisoners seeking new hearings have no constitutional right to counsel.

According to the National Conference of State Legislatures, about 2,500 inmates are serving life sentences for crimes committed when they were juveniles, including more than 2,000 — 80 percent — through the kind of mandatory sentencing systems barred on Monday by the court.

The United States is one of the few countries that have not signed the United Nations’ Convention on the Rights of the Child, which bans life sentences without parole and execution for those under age 18, said Connie de la Vega, a law professor at the University of San Francisco School of Law. She also said that while many countries executed more criminals than the United States did, very few had laws imprisoning adults — let alone juveniles — for life without the possibility of parole.

Justices Kennedy, Ruth Bader Ginsburg, Stephen G. Breyer and Sonia Sotomayor joined Justice Kagan’s opinion in the two consolidated cases, Jackson v. Hobbs, No. 10-9647, and Miller v. Alabama, No. 10-9646.