What may seem like prophecy is actually the fruit of research. As a writer, I’ve always been more surprised by reality than by imagination, so I try to hew to science, history and human experience. In both “The Siege” and “The End of October,” I examined what had happened in similar episodes in the past. I spoke to experts who could guide me to create a plausible narrative — from facts that would resonate with the fiction on the screen and on the page.

Pandemics — like wars and economic depressions, with which they often coincide — leave scars on the body of history. So much of the story of civilization has been about our struggle to survive in close quarters with one another, which allows pathogens to proliferate. As some of the most fearsome communicable diseases of the past — polio, typhus, cholera, yellow fever — have been tamed or eliminated, they have receded from the awful prominence they once held in human affairs. Plague killed perhaps 50 million people during the reign of the Emperor Justinian in the sixth century, about half the world’s population at the time. The next plague pandemic, known as the Black Death, was the deadliest in human history, arising in China in 1334 and stalking the trade routes of Central Asia and Europe until it subsided 200 years later. Smallpox, one of the most infectious diseases on record, killed about 400,000 people a year in Europe alone, and of the survivors, about a third became blind.

The scourge didn’t abate until 1796, when an English doctor named Edward Jenner realized that milkmaids seemed immune to the disease. He theorized that they had been protected by their exposure to cowpox, a similar disease found in cattle but not fatal in humans. To test his theory, he took a sample of cowpox from a farm girl named Sarah Nelmes and injected it into his gardener’s 9-year-old son. Months later, Jenner injected the boy with smallpox as well. When the boy failed to become infected, a new age in medicine was born.

As I researched my novel, I realized how close we had come in recent times to facing an existential disease threat. One of the heroes of public health was Carlo Urbani, an Italian doctor who specialized in parasitic illnesses. He devoted himself to fighting flatworms in children living along the Mekong River. In February 2003, he received a call from the French hospital in Hanoi. A dangerously ill patient had arrived from Hong Kong. Antibiotics were ineffective. Doctors and nurses in the hospital were falling ill. (Altogether the man infected 80 people, including more than half the medical workers who cared for him.)

Dr. Urbani imposed a quarantine on the hospital. He was the first to identify what came to be called severe acute respiratory syndrome, or SARS, notifying the World Health Organization of a highly infectious novel disease that could easily become pandemic. He personally ferried blood samples on his moped through the panicked city to a lab. He persuaded the Vietnamese government to address the contagion transparently and decisively. Thanks to his actions, Hanoi was spared the worst, the disease’s spread was curbed in 16 other countries and SARS was contained within 100 days. This was hailed as the most effective response to a potential pandemic in history, but the triumph was shadowed by Urbani’s own death of SARS a month after the outbreak began.