In early March, people began arriving with symptoms of COVID-19. One complained of a cough and had just returned from Wuhan, the Chinese city where the outbreak erupted. An elderly patient, already on end-of-life care, had a mysterious respiratory infection. Another, struggling to breathe, had come from a nursing home.

Each needed a test for the coronavirus. The hospital had none to offer.

“Testing is so critical,” said Amy Mathers, an infectious disease physician at the hospital and associate director of its clinical laboratory. “Everybody was just hounding me, and I could see how not having in-house testing was getting worse and worse and worse for the patients and the staff.”

Federal authorities had promised for weeks to provide tests for public health labs. They also pledged to quickly approve additional diagnostic tests developed by hospitals and private companies.

UVA’s medical center, part of a top-flight medical school, had banked on those assurances in developing a strategy and backup plans to ensure it could test patients for the novel coronavirus that causes COVID-19. But its efforts were stymied at almost every turn by federal health agencies, the rapid collapse of medical supply chains, and the slow pace of test development by commercial labs and companies. Hospitals in Seattle, Sacramento, Pittsburgh and elsewhere ran into some of the same obstacles.

Even so, within about two weeks of seeing its first coronavirus patients, the Virginia hospital was able to build a robust, in-house testing operation. The medical center now is analyzing scores of samples a day for itself and more than a dozen other hospitals across the state that still lack enough tests to offer the sick. Its capacity exceeds some state labs around the country that relied solely on tests supplied by the federal government.

The path there, however, cost the hospital and caregivers precious time and resources. It left patients in limbo and endangered doctors and nurses, who were unable to diagnose the disease or properly allocate scarce protective gear, let alone assess and contain the threat.

While patients continued to arrive at the medical center with COVID-19 symptoms, hospital staff at UVA spent days scrambling to meet federal requirements for conducting tests in-house. They scoured university labs to satisfy obscure equipment requirements, and they begged colleagues at other institutions for specimens of the virus that were in frustratingly short supply.

The hospital’s travails in developing its own testing capabilities demonstrate the challenges for health systems frustrated by the U.S. government’s inability to provide emergency supplies and equipment to battle the coronavirus. Its struggles also offer an inside look at a regulatory system that slowed America’s early response.

“It felt like it took three months to get through those two weeks,” said Melinda Poulter, a clinical microbiologist and director of the UVA hospital lab. “It felt like a constant uphill battle with people throwing rocks at you from the top of the hill.”

The two federal agencies that oversaw testing, the Centers for Disease Control and Prevention and the Food and Drug Administration, have cast blame on the other for delays in testing.

CDC spokesman Benjamin Haynes acknowledged that “this process has not gone as smoothly as we would have liked.”

FDA Commissioner Stephen Hahn defended his agency’s work at ensuring tests produced accurate results. “The FDA’s regulations have not hindered or been a roadblock to the rollout of tests during this pandemic,” Hahn said in a statement.

Public health specialists and doctors say the United States lost valuable time as CDC and FDA officials clung to standard procedures for too long while hospitals such as UVA’s stood ready to help limit the spread of the virus.

“We could have saved probably tens of thousands of lives by doing testing early and really isolating and quarantining all known cases,” said Lawrence Gostin, a professor and director of the O’Neill Institute for National and Global Health Law at Georgetown University. “But that window of opportunity is gone.”

More than 370,000 coronavirus cases have been confirmed in the United States as of Tuesday, including 11,000 virus-related deaths.

As cases of COVID-19 emerged in the United States in late January, the UVA lab team wasn’t immediately concerned about having tests ready.

Genetic tests for the coronavirus had been developed quickly in China, and the World Health Organization had made a similar testing protocol available to any country that wanted it. In the United States, the CDC opted to develop its own protocol, as it typically does when new viruses emerge. It would serve as a template that labs around the country could use to set up their own testing operations.

Poulter and Mathers were confident they could make the CDC protocol work in their lab, which routinely develops genetic tests to diagnose patients for flu and other viruses. Besides, commercial test manufacturers were assuring hospitals that they would have tests available that could promptly process large numbers of samples.

By mid-February, Poulter and Mathers had settled on a plan: develop a test using the CDC protocol and have it ready “early on, while our patient volumes are still low,” Poulter said. Later, when caseloads climbed, “we expected the commercial vendors would have higher throughput options available.”

That plan unraveled on both fronts.

The CDC’s test was issued first to public labs at the state and local level in early February. Problems surfaced within days. The CDC test was unreliable, and the agency began to work on a fix.

As they awaited more details from the CDC, Poulter and Mathers considered starting from scratch on their own test – a process well within the UVA lab’s capabilities. But that would have required getting FDA approval, a notoriously slow, complex process they had little experience navigating.

Typically, hospital labs have broad leeway under federal law to develop in-house diagnostic tests. But because the Trump administration had declared the virus a national emergency, tougher regulatory rules were in effect.