A Philadelphia Common Pleas Court judge has ordered Hahnemann University Hospital to remain open until a closure plan is approved by the city health commissioner and a bankruptcy judge, even as services continue to be shut down at the debt-ridden safety-net hospital.

More than 800 women were notified by their doctors that they will have to deliver their babies elsewhere as of Friday. The 496-bed institution had just 97 inpatients on Tuesday afternoon, according to the city.

The court order, dated July 3 but recorded Monday, granted the city’s motion in a lawsuit brought by Drexel University to halt further action to close the hospital. Drexel uses Hahnemann as its primary teaching hospital.

State and city regulators have demanded that Hahnemann’s owner, American Academic Health System, keep the doors open until a plan is approved to wind down operations.

Yet Drexel University College of Medicine’s department of obstetrics and gynecology sent letters on Tuesday to 819 patients informing them Hahnemann will close its maternity unit on Friday. Last year, the unit delivered about 130 babies a month.

“The hospital will halt all nonemergency surgeries and procedures by July 12, and it is necessary to plan for future surgical procedures and deliveries at another location,” the letter said. “If you are due to give birth in July or August, we will contact you by phone to help arrange for your admission to another Philadelphia hospital."

Significant portions of the 171-year-old institution, including trauma and critical care in the emergency department, have been shutting down since the June 26 announcement that the hospital would close. Four days after that announcement, American Academic Health System filed for bankruptcy for both Hahnemann and St. Christopher’s Hospital for Children, but it is not closing St. Christopher’s.

City officials said they are seeking a safe transition for patients of the hospital, most of whom live in nearby low-income neighborhoods.

“The city accepted Hahnemann’s representation that it no longer had the capability to treat trauma patients. They made the same representation to the state. The city’s goal is to ensure that the closure is safe and orderly,” city spokesperson Mike Dunn said Tuesday evening.

“Hahnemann Hospital continues to operate safely, with adequate staff and supplies,” Dunn said in an email.

As for ending obstetric services, the Philadelphia Department of Public Health said in a statement: “The city is aware of the announcement and continues to work with obstetrics departments across the city to ensure that every pregnant mother and newborn infant gets the best care throughout pregnancy, delivery, and afterwards.”

Whether closing that service violates the court order was not clear Tuesday.

In her order, Judge Nina W. Padilla wrote that Hahnemann is “enjoined from closing, ceasing operations, or in any way further reducing or disrupting services at the Emergency Department of Hahnemann University Hospital” before a closure plan is approved by the city’s health commissioner and a bankruptcy judge.

Representatives for Drexel did not respond to a request for comment about the court order late Tuesday.

“We have received Judge Padilla’s order regarding the emergency room closure and it is under review. In the meantime, we continue to work diligently and in good faith with the Pennsylvania Department of Health and the City Health Commission to assure the orderly and safe closure of Hahnemann University Hospital," a spokesperson for Philadelphia Academic Health System, which is part of American Academic, said in a statement.

An attorney for American Academic Health System Chairman and CEO Joel Freedman declined comment.

Patients still will be able to get prenatal and gynecology care from Drexel ob-gyn’s four medical office locations and its midwife health center, the Drexel letter said.

Freedman, a California investment banker, has faced financial turmoil almost from the moment the firm bought the two hospitals last year, paying $170 million to Tenet Healthcare Corp.

Hahnemann draws largely from North Philadelphia neighborhoods, many within walking distance, and a large proportion of patients are on Medicaid, the government health plan for the poor.

Owen Montgomery, chair of Drexel’s department of ob-gyn, called Hahnemann’s demise a “tragedy.”

Asked what would happen if a woman in labor — unaware of the maternity shutdown — walked into Hahnemann’s emergency department on Friday or later, Montgomery said she would be stabilized and transferred by ambulance to another hospital.

The letter from the ob-gyn department said it is “working closely” with Thomas Jefferson University Hospital to transfer care there, but patients can deliver “in any hospital you choose.” Without Hahnemann, Philadelphia will have five hospital maternity units, plus a special delivery center for high-risk pregnancies at Children’s Hospital of Philadelphia. The city lost nine maternity wards between 1997 and 2007.

At the Maternity Care Coalition, executives said they had no forewarning of Hahnemann’s abrupt move. The Philadelphia-based nonprofit — which is dedicated to improving maternal and child health with a focus on low-income families — has been part of local efforts to make childbirth safer.

The closure “does concern us from the standpoint of trying to reduce maternal mortality,” said Marianne Fray, the coalition’s chief executive officer. “The more barriers to care, the more it increases that possibility that they’ll have adverse outcomes.”