Drexel University and Tower Health agreed Friday to buy St. Christopher’s Hospital for Children out of bankruptcy for $50 million in a deal that will put the safety-net hospital under nonprofit ownership for the first time in more than 20 years.

“This will ensure that the hospital remains a vital resource to families in North Philadelphia and throughout the city and region, and that Drexel’s medical education training program at the institution will continue,” Drexel president John Fry said in an email to faculty.

The sale agreement is subject to bankruptcy-court approval — a hearing is scheduled for Monday. The agreement calls for the deal to close by Dec. 15.

St. Christopher’s parent company, which filed for bankruptcy in June, had scheduled an auction of the children’s hospital for Thursday, but decided to cancel it in favor or negotiating with the Drexel-Tower group.

“We needed $50 million to make this deal work from the bankruptcy perspective, and we were able to get there with the certainty of closing with two highly regarded Philadelphia institutions,” said J. Scott Victor, managing director of SSG Capital Advisors LLC and the investment banker handling the sale.

“It’s good for St. Christopher’s. It’s good for Drexel. It’s good for Tower. It’s good for Philadelphia,” he said.

A second potential buyer was KPC Group, a for-profit that operates seven hospitals in Southern California. It submitted an initial offer, but never got to bid in an auction.

Drexel and Tower, which have a new 20-year academic affiliation agreement and are collaborating on medical-school campus near Tower’s flagship hospital in Berks County, will be equal partners in the ownership of St. Christopher’s, Fry said. Tower will operate St. Christopher’s.

The purchase of St. Christopher’s will add to Tower’s growing presence in Southeastern Pennsylvania, where it bought five community hospitals in 2017. Last year it added 19 urgent-are sites, mostly in Bucks, Chester, and Montgomery Counties, through the acquisition of Premier Urgent Care.

St. Christopher’s would be Tower’s second Philadelphia hospital. It acquired Chestnut Hill Hospital in 2017 as part of a $418 million deal that also gave it four additional hospitals in Montgomery and Chester Counties.

The St. Christopher’s real estate is owned by separate companies and was not included in the bankruptcy. It may be sold in a separate deal. If that sale falls through, Drexel and Tower could take on the current lease.

St. Christopher’s, which traces its roots to a pediatric clinic opened in Kensington in 1875, landed in bankruptcy after longtime owner Tenet Healthcare Corp. sold it and Hahnemann University Hospital last year to California investment banker Joel Freedman for $170 million.

Because its finances were intertwined with the money-losing Hahnemann, it’s not clear whether St. Christopher’s is profitable. St. Christopher’s had $290 million in net patient revenue last year, according to federal government data compiled by American Hospital Directory.

A group of St. Christopher’s doctors advocating for a local, nonprofit owner said primary care doctors affiliated with the hospital care for more than 30,000 children each year in what they described as the second-poorest congressional district in the nation. Its emergency department logs 65,000 to 70,000 visits annually, the doctors said. The hospital employs 1,500, including 237 physicians, according to a bankruptcy document.

Four Philadelphia nonprofit health systems led by Jefferson Health said in July that they were interested in acquiring the 188-bed St. Christopher’s, which gets about two-thirds of its revenue from Medicaid, but the group decided not to bid by Wednesday’s deadline. The consortium supplies 60 percent of St. Christopher’s inpatient transfers.

Tower and Drexel, with the backing of the University of Pennsylvania Health System, also teamed up in a separate auction last month for Hahnemann’s residency programs, but lost to Jefferson’s $55 million bid. Federal regulators are trying to block that sale in U.S. District Court in Delaware, where the parent company of Hahnemann and St. Christopher’s filed for bankruptcy.

Hahnemann, which discharged its last patient on July 26, was the primary teaching hospital for Drexel’s College of Medicine. Drexel’s medical school also sends students to St. Christopher’s for training in their third and fourth years of medical school.

Integrating the five hospitals Tower purchased in 2017 has been difficult. In the year ended June 30, they had an operating loss of $129 million on $542 million in revenue. Tower’s overall operating loss was $168 million.

“We are confident that our performance in [fiscal 2020] will return to profitability,” Tower chief financial officer Gary Connor said last month.