A 7-year-old boy who traveled to the state to spend the summer with his father and who, prosecutors say, was severely beaten by him on Father's Day can be removed from life support, a judge ruled Wednesday.

Juvenile Court Judge Carol Erskine delivered the ruling after a hearing in which a doctor at UMass Memorial Medical Center testified that the boy, Nathaniel Turner, didn't respond to a number of neurological tests. Dr. Scot Bateman said the hospital also got a second opinion from a Boston doctor that the boy was brain dead.

The judge gave custody of the boy to his mother for the purpose of deciding whether to donate his organs. Before ruling, the judge called the case "a heartbreaking and gut-wrenching situation," and she asked the media not to photograph any family members.

After the judge made her decision, family members could be seen crying and hugging each other as lawyers escorted them out of the courthouse.

Relatives said Nathaniel had lived with his maternal grandmother in Eufaula, Ala., before going to live with his father, Leslie Schuler, in Worcester, the second-largest city in New England, with a population of about 175,000, located just west of Boston. Schuler, 36, recently had received a court order to have summer custody of him.

The boy was physically and mentally abused by his father for about two months, police said. On Father's Day, he suffered severe injuries when his father slammed his head into a bedroom wall with such force that it left a dent in the wall, they said.

Schuler was arraigned Tuesday on seven counts of assault and battery and three assault counts. He pleaded not guilty and was held on $250,000 cash bail. His lawyer, Christopher Tully, said his client was remorseful.

Worcester District Attorney Joseph Early Jr. said the case had become a homicide investigation, but he would not immediately comment on whether charges against Schuler would be upgraded to murder.

Schuler's lawyer requested at the hearing that the boy remain on a ventilator.

Nicholas Morana, a lawyer representing the boy's mother, said his client agreed with the hospital's assessment of her son's condition.

"She's devastated and very frustrated," Morana said. "She is angry at the father for what happened."

A spokesman for the district attorney's office said the family had requested that the mother's name not be released.

Schuler's girlfriend, Tiffany Hyman, was charged with two counts of assault and battery. Police said it appeared Hyman, 28, didn't strike the boy but could have intervened and stopped the abuse. She was held on $50,000 cash bail.

Her lawyer, Jose Rosario, said police reports contained no information indicating she touched the boy.