OAKLAND, Calif. — A judge said Friday that the mother of a 13-year-old girl who was declared brain dead after tonsil surgery can remove her daughter from a California hospital if she assumes full responsibility for the consequences.

Alameda County Superior Court Judge Evelio Grillo said Jahi McMath can be transferred under a deal with Children’s Hospital Oakland that will hold Nailah Winkfield accountable for developments that could include McMath going into cardiac arrest.

Hospital officials have argued since before Christmas that the girl’s brain death means she is legally dead and she should be disconnected from the ventilator that has kept her heart pumping.

Winkfield, refusing to believe her daughter is dead as long as her heart is beating, has gone to court to stop the machine from being disconnected. She wants to transfer her daughter to another facility and wants to force Children’s Hospital to first fit McMath with breathing and feeding tubes or allow an outside doctor to perform the surgical procedures.

Unlimited Digital Access. $1 for 4 weeks.

Grillo on Friday rejected the family’s move to have the hospital insert the tubes, noting the girl could be moved with the ventilator and intravenous fluid lines she has now. He also refused to compel the hospital to permit an outside doctor to perform the procedures on its premises.

The family’s attorney, Christopher Dolan, nonetheless called the agreement a big step in resolving the dispute. Dolan said the family has found an unaffiliated physician to put in the tubes and that an outpatient clinic in New York that treats people with traumatic brain injures has expressed willingness to care for McMath.

It was unclear when the girl might be moved.

McMath went into cardiac arrest after the Dec. 9 tonsil surgery. Three doctors have declared the girl brain dead based on exams and tests showing no blood flow or electrical activity in either her cerebrum or the brain stem that controls breathing.

Multiple outside doctors and bioethicists observing the case have confirmed that a patient in that condition meets the legal criteria for death and has no chance of recovering.