The federal government, as expected, on Thursday took the first step in appealing the controversial bankruptcy sale of Hahnemann University Hospital’s doctor-training programs to Thomas Jefferson University Hospitals Inc.

The notice of appeal sets the stage for a showdown in U.S. District Court in Delaware.

U.S. Bankruptcy Judge Kevin Gross issued an order Tuesday approving the $55 million sale over the objections of the Centers for Medicare and Medicaid Services (CMS), which provides money to pay for medical education at the nation’s teaching hospitals, but gave regulators seven days to win a stay in U.S. District Court.

CMS has until Tuesday at midnight to win a temporary stay of the sale of the residency program, which brings in at least $40 million in federal funding for training hundreds of doctors in the region. The federal agency considers the sale illegal and fears that it could send a message to the owners of struggling hospitals that residency slots are assets available for sale.

The appeal extends the legal fight over Hahnemann, which discharged its last inpatient on July 26. Though it couldn’t admit anyone to the hospital, Hahnemann’s emergency department didn’t officially close until Aug. 16.

Those closures of the inpatient floors and the emergency department form the basis of the objection by CMS, which is part of the U.S Department of Health and Human Services (HHS).

“When a hospital closes, the resident slots are distributed by HHS,” U.S. Department of Justice Attorney Marc S. Sacks said last week at a hearing on the sale. “There is no property right in a residency slot.”

The hitch is in the definition of when a hospital is closed, triggering the termination of a hospital’s Medicare provider agreement. A teaching hospital’s provider agreement specifies how many residents a hospital is allowed to employ using Medicare money. That’s what Jefferson wants to buy.

Federal regulations say that a Medicare agreement terminates when a hospital ceases business operations. That happens, according to a regulation cited by Gross in his decision delivered Thursday from the bench, when the hospital stops “providing services to the community.”

Gross, citing testimony by Allen Wilen, the chief restructuring officer for Hahnemann’s parent company, said the hospital “continues to provide care by referring patients to other hospitals and sending records.”

Sacks’ argument that it’s “the provenance of CMS to determine if a hospital is open” held no weight with the judge.

This week, elected officials started weighing in on the unprecedented sale of residency slots. The residents who were at Hahnemann when it closed have since dispersed to other hospitals in the region and around the nation, but Gross’ sale order specified that when the current residents complete their training, CMS must direct the money used to pay them to Jefferson.

Jefferson is the official buyer, but it formed a coalition of Philadelphia-area nonprofit systems to use the residency positions when the current residents are done with their programs.

The coalition also includes Christiana Care Health System, Cooper University Health Care, Einstein Healthcare Network, Main Line Health, and Temple University Health System. They have not yet disclosed how the resident positions will be distributed among the coalition members if they complete the purchase.