(CNN) As coronavirus test kits were malfunctioning in public health labs across the country, Dr. Robert Redfield repeatedly assured his fellow task force officials in February that the problem would be quickly solved.

The White House had little reason to doubt Redfield. His agency, the Centers for Disease Control and Prevention, had a storied history as the preeminent testing authority.

Even as the problem persisted and days stretched into weeks, Redfield and Health and Human Services Secretary Alex Azar -- then the lead of the coronavirus task force -- provided "assurances it was being dealt with," a senior administration official said.

Most other members of the recently created White House task force -- officials from the chief of staff's office and the National Security Council -- weren't public health experts. They placed their faith in the nation's top health officials.

"When the CDC, who was has always been able to handle these things -- when they tell us they have this thing under control, who are we to say, 'You double PhDs, MDs who have been doing this for years, no you're wrong,'" said the administration official.

It took roughly three weeks to sort out the failed test kits, far longer than the CDC had anticipated. Along the way, regulators would discover the lab producing the test kits was contaminated, likely causing the tests to malfunction, according to a senior administration official.

CDC Director Robert Redfield leaves the Capitol after he and others from the coronavirus task force briefed Congress in February (AP Photo/J. Scott Applewhite)

Officials would scramble to cobble together a solution to get diagnostic tests to the states. And throughout it all, the deadly virus ---- far more contagious than health experts initially thought -- was spreading across the country, largely undetected.

In addition to squandering time on the flawed test, federal officials failed to ensure there would be ample testing supplies to support the effort, established such restrictive testing guidelines that sick people were being denied tests, and did not fully enact a 2018 agreement with public and private labs aimed at quickly enlisting their help in such a health crisis. By the time commercial labs were brought into the effort, the demand for tests was so high that backlogs further delayed results, CNN found.

The Trump administration's failure to quickly scale up testing would continue to cripple the US response to the pandemic for months. Even now -- three months after the first detected case of the coronavirus in the US -- testing remains a key challenge to President Donald Trump's push to reopen the economy.

"There's very little that has gone well. Actually, I'm not sure what has gone well," said Scott Becker, who heads a national association of health labs and has been deeply immersed in the response to the crisis. "It's just been a continuing cascade of challenges."

Caitlin Oakley, an HHS spokeswoman, defended testing efforts under Azar.

"Secretary Azar responded with urgency at every step of the response and continues to do so," she said in a statement to CNN. Any insinuation that he didn't is "just plain wrong and disproven by the facts."

A CDC spokesman said Redfield did not offer any assurances about how long it would take to fix the testing problem because the CDC didn't know what was causing it at the time.

This account of the administration's struggle to build a widespread testing infrastructure is based on documents from public records requests, internal records from a private testing facility obtained by CNN, and interviews with current and former government officials, public health experts, doctors and scientists.

The test fails

Medical personnel in San Francisco secure a sample from a person at a drive-thru coronavirus testing station in March. (Photo by Justin Sullivan/Getty Images)

Public health officials were eagerly awaiting the CDC test kits when they were shipped out Feb. 6.

In Orange County, Calif., staffers in the public health lab worked over the weekend to get the test up and running. They quickly grew frustrated, realizing they couldn't validate the test.

"Lab networks talk," said Dr. Matt Zahn, medical director for the communicable disease control division of the Orange County Health Care Agency. "We were all talking to each other around the country saying there is a problem here. What wasn't clear is what the solution to that would be."

Zahn knew the virus was likely circulating in the community because California has a lot of travelers to and from Asia. His mind drifted to worst-case scenarios.

"If a virus gets into healthcare facilities, gets into hospitals, gets into nursing homes -- that was our major concern," he said. "It was just really tough."

Within days of shipping out the tests, the CDC began getting reports that they weren't functioning properly. By Feb. 10, more than half the states were reporting problems with the test kits, a federal official said.

The CDC notified the Food and Drug Administration about the problem and began consulting with the FDA on ways to fix it.

In the meantime, the only way to test a coronavirus patient in the US was to collect a sample and send it to the CDC for testing. On average, the official said in those initial testing days it took "three to four days" to get a result back to the person who took the specimen.

Leadership vacuum

President Donald Trump speaks about the coronavirus at the White House on April 13, 2020, in Washington. (AP Photo/Alex Brandon)

It was the sort of problem that Trump boasts he's well-suited to solve: Test kits desperately needed to track and help control the rapidly spreading coronavirus were partly tangled in government red tape that needed to be cut.

The clock was ticking.

Lives were on the line.

But for weeks, the President, who casts himself as a take-charge, hands-on, problem-solver-in-chief continued to publicly downplay the entire coronavirus threat even as the debacle over a botched government test played out.

There was a leadership vacuum in the West Wing as acting chief of staff Mick Mulvaney had fallen out of favor with Trump, but his replacement, Mark Meadows, had not yet been named.

The result was no early, coordinated push from the White House to scale up testing, perhaps by pursuing alternatives, like authorizing the test the World Health Organization had distributed to other countries or soliciting help from labs in commercial, hospital or university settings.

In fact, the government had a signed agreement to deal with just such a crisis. In 2018, on the heels of the Zika virus scare, officials realized the need to engage commercial labs in testing at the outset of an outbreak. But the pact was not enacted to speed up testing in the early stages of the Covid-19 response.

As for the President, he was still in denial and publicly predicting the virus would "miraculously" go away.

Sleepless nights

Becker, CEO of the Association of Public Health Laboratories, was having trouble sleeping.

He had been "peppering CDC constantly" for an update on when new tests for the virus would be distributed.

He's been on calls with the CDC since before the initial roll out.

"We all knew there was a problem," Becker recalled in an interview with CNN.

"It was desperation. We have to break through this," he recalled thinking as the delay continued. "I was panicking. I was just trying to rack my brain, thinking about 'what can we do?'

He woke up on Sunday, Feb. 23 with "a crazy idea": To write the FDA and seek permission for the labs he represents to "create and implement" their own tests.

"We recognize the gravity of the current Covid-19 situation across the globe," Becker and a colleague wrote to FDA Commissioner Stephen Hahn the following day. "Hence this extraordinary and rare request."

Two days later, Hahn effectively greenlit Becker's proposal, allowing his group's labs to apply to design a test under one blanket application as opposed to having to file them separately.

FDA officials insist that the labs had always had the ability to create their own tests. But FDA regulations, specially imposed once a state of emergency had been declared, proved daunting to commercial and clinical labs.

Around this same time, Redfield, the CDC director, appeared before a Congressional subcommittee. In prepared remarks, he talked about the CDC's testing rollout earlier that month and acknowledged "an issue with one of the testing components was discovered."

He did not detail the problem or say what caused it, according to the statement, but told committee members his agency was "working on remanufacturing the test kit."

President Donald Trump speaks at a news conference on the Covid-19 outbreak. (Photo by Andrew Caballero-Reynolds-via Getty Images)

Contaminated

Behind the scenes a more troublesome issue was emerging: In its rush to create tests, the CDC had done so in one of its laboratories rather than one of its manufacturing facilities, compromising the manufacturing process, according to administration officials.

"CDC did not manufacture its test consistent with its own protocol," an FDA spokesperson said.

FDA officials were getting mixed messages in mid-February about why the CDC test kits were malfunctioning. At first it appeared to be a manufacturing issue, but then the CDC suggested it could be a problem related to the test design, according to two FDA officials.

That was worrisome to the FDA. On Feb. 22, a diagnostics expert at the agency, traveled to Atlanta and spent a couple of days at the CDC labs trying to figure out what was going on.

According to an administration official, the FDA determined contamination was most likely occurring during the manufacturing process and that was causing the tests to malfunction. CDC spokesman Benjamin Haynes said the matter is being investigated.

"Routine quality control measures aim to identify these types of issues. Those measures were not sufficient in this circumstance, and CDC implemented enhanced quality control to address the issue and will be assessing this issue moving forward," Haynes said.

Another federal official conceded: "There was a rush to get kits out to the states, that might have led to some of the mistakes that were made in our lab, that's fair."

In the final days of February, the FDA and the CDC worked out two solutions.

The test kits the CDC already manufactured had three components, the third of which was malfunctioning. But the tests worked using two of the three components. So, the CDC and the FDA instructed states to use the original CDC test, but eliminate the test's third component.

The CDC would also work with an outside manufacturer, IDT, to remanufacture test kits to be shipped to public health labs across the country.

"There's no question mistakes were made in the labs. And then you couple that with the regulatory process. It explains the weeks delay," the federal official said.

"That's the way it is."

Everyone stays on this call

CDC Director Robert Redfield and Dr. Anthony Fauci, director of the National Institute of Allergy and Infectious Diseases, attend a briefing on the administration's coronavirus response. (Photo by Drew Angerer/Getty Images)

Alarmed by the delay in getting tests up and running, Dr. Anthony Fauci, director of the National Institute of Allergy and Infectious Diseases, asked for administration officials to convene by phone on Feb. 27, according to a senior administration official.

Azar's chief of staff made clear to the call's participants -- which included FDA Commissioner Hahn, CDC Director Redfield, and other senior FDA and HHS aides -- that everyone was staying on the call until they could figure out a way to solve the testing shortage, the official said.

A solution emerged: Loosen the FDA regulations to pave an easier path for outside labs to jump in on coronavirus testing.

The FDA announced the change Feb. 29, effectively opening the floodgates for clinical labs to ramp up their coronavirus testing efforts.

"The FDA's regulations have not hindered or been a roadblock to the rollout of tests during this pandemic," Hahn said in a March 30 statement

Invisible enemy

The delays in coronavirus testing would prove costly.

Many officials initially underestimated how contagious the coronavirus would be. Initial guidelines from the CDC called for screening patients for travel only from Wuhan, China, which immediately raised red flags with other public health officials.

"We will be instructing our healthcare providers to ask about any travel from China as we expect this to broaden in the very near future," Arkansas Secretary of Health Nathaniel Smith wrote to other state health officials across the country on Jan. 21 -- the day the first US case of the coronavirus was reported. It was one of the thousands of emails obtained by CNN in public records requests.

The CDC was slow to broaden its geographical screening guidelines to include the rest of Asia as well as Europe. And its list of symptoms didn't account for gastrointestinal distress, loss of taste and smell or eye infections that some coronavirus victims would wind up presenting with. Experts were learning new information about the virus in real time, but some say the CDC was slow to adjust.

"The definition of who could be tested was pretty tightly drawn," said William Schaffner, professor of preventive medicine and infectious diseases at the Vanderbilt University School of medicine and longtime CDC adviser. "The CDC really persisted, from my point of view, considerably too long with that very narrow focus." A federal official defended CDC, saying agency officials based their decisions on data they had at the time.

Even as it became clear the virus was spreading person-to-person in the US, Redfield said January 30, "the immediate risk to the American public is low."

Meantime, flights began arriving in the US, evacuating Americans from China. An outbreak emerged at a nursing home near Seattle, killing dozens of people associated with the facility. And the US began bringing home Americans stranded on the Diamond Princess cruise ship, which had been ravaged by the coronavirus.

"It was just sad," Jeffrey Engel, executive director of the Council of State and Territorial Epidemiologists said, reflecting back on the initial testing failures in February. "I'm thinking if we had had that testing capacity that we had all hoped for two weeks earlier and shown community transmission, say in Seattle, we would have saved lives in that nursing home. I mean that's possible."

So far, more than 40,000 have died from the coronavirus in the US, according to data from Johns Hopkins University.

"This invisible enemy is tough and it's smart and it's vicious," Trump said Friday.

Drone pictures show bodies being buried on New York's Hart Island. REUTERS/Lucas Jackson/File Photo

'We did a lot'

Some health officials said there was almost certainly going to be a shortage of testing, even if the CDC hadn't stumbled so severely at the outset.

"There's quite a bit of discussion of, 'oh we missed the boat on being able to do any kind of containment," said Marcus Plescia, chief medical officer for the Association of State and Territorial Health Officials. "I'm afraid we would have been behind on the containment one way or another."

The US needed to dramatically scale up the workforce surrounding its testing infrastructure, Plescia said, to contact those who are infected and the people they came into contact with. That capacity wasn't available in state and local health departments in February and March, he said.

As Trump agitates to reopen the economy, the White House is pushing a variety of strategies to help track the virus. It is setting up surveillance systems -- similar to those used to track flu outbreaks -- to monitor vulnerable communities for coronavirus. And it is aiming to ramp up antibody testing to determine who has already been exposed to the virus.

But the White House is buckling under pressure from expectations the President set -- publicly.

"Anybody that wants a test can get a test," Trump said in a March visit to the CDC, surprising even some CDC officials.

Now Trump is looking to shift the testing burden -- and blame -- to the states, insisting they have enough testing capacity to reopen, even as governors say they're still facing shortages of testing ingredients like swabs and reagents.

Republican Maryland Gov. Larry Hogan said it's "absolutely false" that governors have plenty of tests and aren't doing their jobs. Democratic Virginia Gov. Ralph Northam called Trump's testing capacity claims "delusional."

Becker, the health labs CEO, said Saturday that he sees things "easing up a bit," but that daunting challenges remain.

For example, he said, his group recently received some 200,000 swabs for testing. The problem, he said, was that they'd requested 2.5 million.

"It's getting brighter," Becker said, referring to a light at the end of the tunnel. But, "I still think we're at least a month away."

Confronted during a recent White House briefing with the administration's failure to quickly ramp up testing, Trump insisted he and his team had not squandered key weeks in the month of February.

When a reporter pressed for details of what had been done, Trump provided none.

"A lot. A lot," he said April 13. "We did a lot."

On Sunday, Trump turned to Twitter defend his efforts yet again.

"I am right on testing," he wrote.