Get breaking news alerts and special reports. The news and stories that matter, delivered weekday mornings.

In April 1998, President Bill Clinton read a Richard Preston novel, "The Cobra Event," about a biological attack on the U.S. using a lethal virus that spreads like the common cold.

"It scared the bejesus out of him," recalls Kenneth Bernard, a now retired U.S. Public Health Service official who was then representing the U.S. in Geneva at the World Health Organization.

Clinton set the wheels of government in motion, and the result was the first federal government effort to marshal resources in preparation for a pandemic, including the creation of the National Emergency Medical Stockpile, which stowed vaccines and medical gear in secret locations around the country. Bernard was appointed as the first official on the National Security Council whose sole job was to focus on health threats.

The interest in germs as a national security concern didn't last.

Instead, it kicked off a boom-and-bust cycle of pandemic preparedness that persisted into the Trump administration. By many accounts, Trump fell on the bust side of the equation when he fired his top biosecurity adviser, allowed the disbanding of his global health unit, and initially downplayed the coronavirus as it spread across the world.

The result was a perfect storm: A U.S. government not well prepared for a pandemic, run by a president who was slow to act after his intelligence community and public health advisers were warning about the dangers.

Trump's response has been well documented.

Less understood is how the U.S. government over 20 years of successive administrations and Congresses failed to heed the warnings by taking basic steps that would have made it easier to quickly respond to a fast spreading and lethal pathogen. They didn't set up and fund a large volunteer medical reserve corps, for example, or build surplus hospital capacity, or create a system to quickly produce and deploy virus tests.

For more than two decades, despite gloomy forecasts about the likelihood of a pandemic from intelligence assessments, public health reports and government exercises, elected officials from both parties have never fully geared up for the biological threat, former officials and public health experts told NBC News. Each new White House deprioritized the issue, only to elevate it later after some defining event led to a presidential revelation. They then belatedly scrambled to respond with ambitious plans and initiatives, which faded after a few years.

Human nature played its part. Just like what happened before the terrorist attacks of 2001, it proved impossible for the country to become energized about a threat it could not collectively imagine.

Much like climate change, pandemics can seem theoretical, or at least a danger that touches foreign countries, not the U.S. Rapid advances in modern medicine — eradicating smallpox, polio and many other infectious diseases — appear to have lulled Americans into complacency.

Pandemics were the stuff of Hollywood movies: the 1995 film "Outbreak" portrays an Ebola-like infection ravaging a small California town. The 2011 film "Contagion" depicts the deadly effects of a virus originating from bats in Asia, and includes terms like "social distancing," with which many Americans are now unpleasantly familiar.

But that was fiction.

"Here's the problem: In 10 years, if there's no pandemic, then everybody starts getting a bit relaxed," said Michael Leavitt, a former Utah governor who served as secretary of Health and Human Services in the Bush administration.

"When there's not an alert, and people are not standing on the balls of their feet, anything you say about a pandemic in advance just sounds alarmist."

Intermittent interest, shrinking budgets

When President George W. Bush took office in 2001, Bernard wrote a transition memo. He soon learned the Bush team had eliminated his job as White House biodefense czar.

"They just threw the memo away, and said, 'This is not a national security issue. This is one of those Clinton things.'"

Former President George W. Bush looks at Ebola cultures through a microscope while touring the National Institutes of Health Vaccine Research Center in Bethesda, Maryland, on Feb. 3, 2003. At the NIH, Bush promoted "Project Bioshield," a plan to produce vaccines and treatments against biological weapons like anthrax and the plague. Pablo Martinez Monsivais / AP

But after 9/11 and the subsequent anthrax attacks, the newly created Department of Homeland Security hired Bernard back, with added staff, to run a bio-preparedness unit.

After Bush read a book about the 1918 influenza pandemic in 2005, he forced his administration to double down on pandemic preparation, replenishing the stockpile and creating an early warning system.

Download the NBC News app for full coverage of the coronavirus outbreak

Former Bush administration officials say the effort could not be sustained amid two wars and a global hunt for terrorists.

President Barack Obama's focus was also on terrorism, but he dealt with disease threats, including the H1N1 flu outbreak. Evaluating the Obama administration's response, William Schaffner of Vanderbilt University School of Medicine told the New York Times that officials deserved "at least a B-plus," and Mount Sinai virologist Peter Palese called the overall response "excellent." Republicans in Congress praised the CDC for developing a vaccine in six months.

Let our news meet your inbox. The news and stories that matters, delivered weekday mornings. This site is protected by recaptcha

When Ebola erupted in Africa in 2014, Obama brought in an outsider, Ron Klain, to run the federal response. The effort was widely praised, as was Obama's response to the 2016 Zika virus outbreak. But afterward, the Obama administration failed to fully replenish the federal stockpiles, according to research by ProPublica and USA Today.

Under Obama and a mostly Republican-controlled Congress, public health spending declined. Per capita public health spending, adjusted for inflation, rose from $39 in 1960 to $281 in 2008, and fell by 9.3 percent from 2008 to 2016, according to a 2016 study published in the American Journal of Public Health. It has fallen further under the Trump administration, records show.

The Centers for Disease Control's budget fell by 10 percent from 2010 to 2019, and the CDC's funding for state and local preparedness was cut by a third from 2003-19, according to a report from the non-profit, non-partisan Trust for America's Health.

"Public health has been a stepchild in American health care for probably 30 or 40 years, and we have undernourished it and underappreciated it," said Leavitt.

Stewart Simonson, who served in the Bush administration and is now at the WHO, wrote in a 2010 health journal article that "Pandemic preparedness has not been a part of the national dialogue long enough to be securely imbedded in the policymaking process — this means it is highly vulnerable to shrinking budgets and shifting priorities."

A nurse prepares to administer the H1N1 vaccine to President Barack Obama at the White House in this Dec. 20, 2009, file photo released by The White House. The White House via AP

During the transition from Obama to Trump, Obama officials conducted a tabletop exercise based on a pandemic with incoming Trump aides. But in his second year as president, Trump fired his top official in charge of pandemic response, Tom Bossert, and did not replace him. Trump then allowed his national security adviser to disband the NSC's global health unit. As a result, when alerts about coronavirus began to emanate from the intelligence and public health communities, there was no senior official in the White House to coordinate a response.

Trump's trade adviser, Peter Navarro, wrote a memo dated Jan. 29 saying the virus could kill half a million Americans and cost nearly $6 trillion. But Trump continued to downplay the situation.

Richard Clarke, who helped create the national stockpile under Clinton and served as George W. Bush's homeland security adviser, observed that while the interest in pandemic threats has been cyclical, nearly every modern president has had to confront the danger.

"Every administration has at some point in time gotten religion and realized there is a program and dusted it off and used it," Clarke told NBC News.

"Except this one."

As Washington dithered, warnings piled up

While political attention ebbed and flowed over decades, there was a chorus of warnings about the increasing threat of a global disease outbreak, and repeated appeals for action. In hindsight, these appeals now sound like Cassandra's futile warnings from Greek mythology.

Among the most consistent voices was the U.S. intelligence community.

Analysts at the CIA and other intelligence agencies have tracked outbreaks and potential epidemics for years, said Mathew Burrows, a former CIA analyst who wrote an unclassified intelligence report called a global forecast in 2004 that cited pandemics in 2004.

"We knew the potential seriousness of it. The effort here was to keep it up there on the policymakers' agenda, to make sure it didn't slip," said Burrows, now a fellow at the Atlantic Council think tank.

The 2004 forecast, "Global Trends 2020," said:

"Some experts believe it is only a matter of time before a new pandemic appears, such as the 1918-1919 influenza virus that killed an estimated 20 million worldwide."

If that happened, the report said, health systems would be overwhelmed, and global trade and travel would grind to a halt.

Burrows was the principal author of two subsequent global forecasts, in 2008 and 2012, and the looming danger of a pandemic received significant attention.

His 2012 analysis ranked pandemics at the top of a list of possible "black swan" events that could cause massive damage and leave no country untouched.

"Unlike other disruptive global events, such an outbreak would result in a global pandemic that directly causes suffering and death in every corner of the world, probably in less than six months," the unclassified report said."Unfortunately, this is not a hypothetical threat."

In recent annual public assessments, American intelligence agencies have been warning about the increasing risks of a global pandemic that could strain resources and damage the global economy, while observing that the frequency and diversity of global disease outbreaks has been rising.

In the 2018 and 2017 documents, intelligence analysts even mentioned a close cousin of the current COVID-19 strain of coronavirus by name, saying it had "pandemic potential" if it were "to acquire efficient human-to-human transmissibility."

Scientists knew this was coming — and that we weren't ready

It wasn't just the spies. Scientists and researchers warned for years.

Pulitzer Prize-winning author Laurie Garrett wrote a seminal book called "The Coming Plague" — in 1994. "The disease-causing microbes of the planet," wrote Garrett, "far from having been defeated, [are] posing ever greater threats to humanity."

In 2007, a journal published by the American Society for Microbiology included an article that warned about the potential for a epidemiological "time bomb" if a new strain of coronavirus emerged from wild animals in a Chinese "wet market," where vendors slaughter live animals for customers. COVID-19 is believed to have originated in such a market.

"Coronaviruses are well known to undergo genetic recombination, which may lead to new genotypes and outbreaks," said the study, whose lead author, Vincent C.C. Cheng, is among the leading researchers in Hong Kong studying COVID-19. "The need for preparedness should not be ignored."

The Government Accountability Office published reports over the past decade about the lack of coordination among federal agencies on preparations for a pandemic or biological terrorism, predicting much of the confusion that has unfolded since the outbreak emerged.

A 2010 GAO report warned that there are not enough skilled workers to deal with pandemics, and cautioned that a 2009 national strategy for situational awareness "does not meet the need for a biosurveillance strategy."

"The biggest concern we've had has been … that lack of one central strategy," said Chris Currie, director of Homeland Security and Justice at the GAO.

In 2015, Microsoft founder and philanthropist Bill Gates said in a Ted talk that the next major killer would not be a war or terrorism — it would be a global disease outbreak.

"We're not ready for the next epidemic," he said.

Failure, as predicted

Last year, the Department of Health and Human Services ran a pandemic simulation dubbed "Crimson Contagion," according to a draft report obtained by the New York Times.

The exercise predicted many of the problems besetting the coronavirus response – confused lines of authority, shortages of medical gear, controversies over social distancing.

Successive administrations and congressional leaders failed to take actions that would have put the U.S. in a better position to respond to the coronavirus outbreak.

They failed to address America's reliance on China and India for most of its generic drugs and the raw ingredients for antibiotic. They failed to set up a system that would insure the rapid deployment of tests for a novel virus. And they failed to replenish a federal stockpile that hospital officials say is both insufficiently stocked and rife with defective gear.

Those failures — and the late start on gear purchases by the Trump administration — have severely hampered the U.S. response to coronavirus, said Scott Gottlieb, who ran the FDA from 2017 to 2019.

"Clearly we didn't have what we needed," he said. "We didn't have enough ventilators, we didn't have enough PPE. Everyone knew in a pandemic scenario we would need those things. And they just weren't there."

The coronavirus pandemic is different from other national catastrophes, including Pearl Harbor or 9/11, said Peter Singer, a scholar at the New America Foundation.

"In no way, shape or form can anyone say that we weren't warned, that the information wasn't available and shared with them," he said. "We've known about the risk of pandemics, and war gamed them literally going back some 30 years."