WASHINGTON – A divided Supreme Court said Thursday that police and courts must consider a child’s age when examining whether a boy or girl is in custody, a move the court’s liberals called “common sense” but the conservatives called an “extreme makeover” of Miranda rights.

The 5-4 decision came in a case in which police obtained a confession from a seventh-grade student while questioning him at school about a rash of break-ins in Chapel Hill, N.C., without reading him his Miranda rights, telling him he could leave or call his relatives.

Justice Sonia Sotomayor, a former prosecutor who wrote the opinion, said police have to consider the child’s age before talking to him or her about a crime. Courts also have to take the child’s age into consideration when deciding whether that confession can be used in court, she said.

“It is beyond dispute that children will often feel bound to submit to police questioning when an adult in the same circumstances would feel free to leave,” Sotomayor said.

But Justice Samuel Alito, also a former prosecutor, said the point of Miranda was that police would have clear, objective guidelines to follow. Opening the door to considering age likely will mean that other characteristics could soon be added to the list, such as educational level, I.Q. and cultural background, he said.

“Safeguarding the constitutional rights of minors does not require the extreme makeover of Miranda that today’s decision may portend,” Alito said.

The special education student, known as JDB in court papers, was 13 in 2005 when he confessed while interviewed by police and school officials in a closed room at his school.

JDB’s lawyer challenged the use of his confessions, saying his client had not been read his Miranda warning. Previous court rulings have required Miranda warnings before police interrogations for people who are in custody, which is defined as when a reasonable person would think he cannot end the questioning and leave.

The North Carolina Supreme Court refused to throw the confession out, saying courts cannot look at age when examining whether the boy thought he could leave. It also said the youth was never actually in custody since he had not been formally restrained and the door to the room was not guarded.