Prince George’s County officials hope to move a 10-year-old boy stuck in Children’s Hospital for more than a month to a residential facility in Philadelphia, county officials said Thursday during a court hearing.

But the wrangling over the boy’s case may continue. During the hearing, D.C. Superior Court Judge Eugene N. Hamilton ordered District authorities to investigate whether the circumstances of the boy’s hospital stay, which began Sept. 15, amount to child abandonment.

Children’s has been trying to discharge the boy since Sept. 28. Officials filed a civil suit against his parents and Prince George’s to move him because, they say, the hospital cannot offer the care he needs. They argued that the boy should be placed in a foster home in the county, where his mother lives, until a proper facility is found.

Prince George’s attorneys argued that they do not have jurisdiction over the case because the boy is in a District hospital. Still, county officials told Hamilton they have identified residential programs in Georgia and Philadelphia that could admit him. They hoped to place him in Philadelphia, closer to family.

The boy’s mother and stepfather, who did not appear to be at the hearing, have refused to take him home, according to court papers. His father does not have custody rights.

Hamilton grew frustrated with the gathered attorneys at times Thursday. “The District of Columbia and Prince George’s County are obviously trying to push this kid off onto the other,” he said. “In the meantime, the child is here in D.C. and has been abandoned and neglected.”

Hamilton, former chief of the Superior Court, ordered the D.C. Child and Family Services Agency to review the case and criticized the agency for responding slowly while a child was “languishing in a place he should not be.”

“Now that we have the information, we’ll investigate,” said Lionel Sims, the agency’s attorney.

Hamilton scheduled a follow-up hearing for Monday. Hospital officials requested that the boy be removed by Tuesday to open space for another patient.

The Washington Post was permitted to cover the hearing on the condition that the boy and his family were not identified. Prior to the hearing, hospital attorney Kenneth Rosenau argued to have the hearing closed to the public and media. Hamilton denied the request.

The boy was admitted to the hospital after he was suspended from school Aug. 31, stabbed a relative and threatened suicide, court papers say. A source close to Children’s Hospital said it was the fourth time he had been admitted there. In court records, hospital officials said the boy’s mother did not believe he was healthy enough to return home.

Prince George’s attorney Milton McIver argued that the civil lawsuit should be dismissed because legal action should have been taken in county courts. Still, he said, county officials were trying to find placement for the child.

In interviews Thursday, Children’s Hospital officials said the boy’s case underscores the larger issue of what care providers should do when a child who needs help is abandoned at the hospital. They said that it happens far too often, and that the Washington region — with patients from the District, Virginia and Maryland — presents unique challenges.

Paramjit Joshi, chief of psychiatry and psychology at Children’s Hospital, said that in this case, doctors determined the boy no longer needed acute care in a locked psychiatric unit and needs a less restrictive setting. But efforts to place him, either at home or with social services, met brick walls.

“When they come to us, we take care of these children the best way we know how, regardless of where they are from,” Joshi said. “We are in a position where we need to force this issue with the various jurisdictions to come to the table so the children don’t get caught in the huge gap that is created.”

The boy’s father was in court Thursday. Dressed in his work uniform, he removed his glasses and rubbed his eyes as the hospital’s attorney spoke of his son’s condition.

Rosenau said it was unclear whether the father could care for his son because he was “unknown to us.” In an interview Thursday, the father said he hopes to gain custody and take the boy home to live with his 1-year-old daughter — the boy’s half-sister — and the girl’s mother.

The father has blamed his relationship with the boy’s mother for long gaps between visits with the boy. But he said he has met and spoken with his son numerous times over the past week and believes that the boy is doing well.

The boy’s mother could not be reached Thursday.

Staff writers Josh White and Ruben Castaneda contributed to this report.