THE OUTBREAK of the Ebola virus in West Africa this year came as a surprise. Perhaps no one could have predicted that such a terrible scenario would unfold. But over the past decade, there have been four major outbreaks of infectious disease caused by a virus: severe acute respiratory syndrome, or SARS; swine flu; Middle East respiratory syndrome; and now Ebola. Each has taken populations by surprise. Next time, the world should not be gobsmacked. It is possible to be better prepared, be more aware of the potential threats and not start from zero every time the alarm goes off.

Speed is of the essence. The global response to Ebola was tardy, in part because 24 previous outbreaks of the virus since 1976, mostly in remote locations, were contained, so it was assumed that this one would also be extinguished quickly. But when Doctors Without Borders began to warn in April that something different was unfolding — that Ebola was getting out of control in West Africa, where it had not previously struck — the call was not heeded.

The World Health Organization response lagged. The U.N. agency has suffered budget cuts and is poorly structured, with regional offices not easily accountable to its headquarters in Geneva. In this case, the Africa office of the WHO was slow to react, and that put the whole organization behind the curve. Margaret Chan, the WHO director general, first learned of the urgency of the situation in June, according to a WHO timeline disclosed by the Associated Press. No doubt the slow response was also a product of public health agencies that were ill-prepared and overwhelmed in the three hardest-hit countries: Guinea, Sierra Leone and Liberia. It would be smart to begin thinking of a more agile and effective organization or system for responding to such dire threats, one that could bring together a capability for surveillance, early warning and rapid response; and that would be wired into the pharmaceutical industry.

Another important lesson is that fighting a disease outbreak is not only a medical challenge but also must take into account economics, politics, culture and traditions. The Ebola response was hampered by deep suspicion among those affected, a failure of responders to build confidence in communities and methods that backfired, such as the containment of a whole section of Monrovia, Liberia, which led to panic and frequent violations of the cordon. The traditional burial methods of touching the deceased and washing the body also spread the disease. Many of these errors were later rectified in an admirable way — special burial teams have been notably effective — but these are lessons that should not have to be learned on the fly. The knock-on effects of the epidemic are still being felt. Half a million people have been classified as “severely food insecure” in the three countries, because of border closures, quarantines, and disruption in food markets and processing chains, according to the United Nations’ Food and Agriculture Organization .

Another lesson is the importance of getting the low-tech, simple things right, such as adequate personal protective equipment for first responders, who have suffered a terrible toll.

Ebola has demonstrated that disease threats do not stop at passport control and that health security is national security. Stopping the virus in West Africa is an investment in keeping it from U.S. soil. The Obama administration has championed a global health security agenda with this in mind, but it was initially slow in rallying to the challenge of Ebola. The president’s decision to deploy the military in September put the United States in position to lead, but that should have happened sooner.

Perhaps the most difficult challenge is to develop biomedical treatments — vaccines and antivirals — for an emergency on the scale of Ebola. It wasn’t a serious threat before, so the pharmaceutical industry did not have the incentives to develop treatments. Someday, it may be possible to dial up a rapid response to a novel disease threat, but science hasn’t found the way yet. More ought to be done jointly by governments and the private sector to improve the ability to swing into action.