By Luis Encinas, Doctors Without borders/Médecins Sans Frontières (MSF) Ebola expert

After two years of epic struggle, the largest Ebola epidemic in history may finally be coming to an end. On January 15, if no new cases are recorded, Liberia will be the last country to be declared free of the Ebola virus in this epidemic.

Ebola brought with it immeasurable suffering; destroyed the fabric of communities and devastated already-fragile health systems. More than 28,000 people were infected with Ebola, of whom more than 11,000 lost their lives. More than 500 health workers are among the dead, lost to countries where they are desperately needed.

The combination of Ebola emerging in countries with fluid borders, weak public health systems, and no prior knowledge of the disease has been described as a “perfect storm.” Each of these elements played a large part, but to reduce the causes of the crisis to only these components also ignores the colossal failure of the global health system to adequately respond.

What lessons must be learned? What must be done differently in the future? For the benefit of all, we must strengthen health systems in developing countries and change our institutions to be able to adequately respond to emergencies. We must avoid a repeat of the paralysis and slowness of international aid witnessed in the epidemic.

Ebola elicited very little official international response until imported cases reached developed countries. Countries that had attempted to shut themselves off through “security measures,” including suspending commercial flights, learned that in today´s interconnected world they could not make themselves immune to epidemics they considered “foreign.”

It was only after a delay of more than six months that the necessary global response was finally initiated and that resources, both human and capital, were dedicated to ending the epidemic. These included expert meetings, mass deployments to affected countries, trainings, the construction and management of treatment centers and laboratories, and people working round the clock to urgently find an effective vaccine and treatment.

In the summer of 2015, we saw some of the fruits of this labor with reports of one of the vaccines yielding positive results.

And yet despite such gains, many lessons remain unlearned. International health systems remain slow and encumbered. The correct handling of future epidemics must focus on patients and their environment to save and protect lives, wherever the greatest needs are identified. Care for patients must include the protection of those looking after them, whether family caregivers or medical staff.

It is essential that we review our capacity to adequately respond to alerts, whether for hemorrhagic fevers, Middle East Respiratory Syndrome (MERS), or a new deadly and contagious disease, and on systems of early detection and treatment. To achieve the urgently needed improvements we must invest heavily in training and in protective and laboratory equipment.

Health authorities in Guinea, Liberia, and Sierra Leone now have the technical knowledge to detect an Ebola outbreak, and there are now laboratories on the ground that did not exist prior to the epidemic. Humanitarian workers, non-governmental organizations, and national and international institutions have received training on Ebola from MSF, the WHO, and the Centers for Disease Control and Prevention (CDC), among others. Now that the knowledge has been shared, we must see it implemented in the early stages of any future epidemic.

While global health system reform discussions have correctly focused on improving surveillance and emergency response, at country level the promotion of privatization of national public health systems is a concern. Strong public health systems are the foundation on which to build a strong emergency response, and efforts must be focused on supporting them.

The use of punitive and coercive policies such as militarily enforced quarantines and movement restrictions must be carefully evaluated, as we have seen inhuman treatment of people and negative consequences arising from this. Criminalizing patients, families, and communities must be avoided.

It is of huge importance that countries that report and fight against an epidemic must be rewarded instead of punished. Fear of the economic and political consequences affected the early response to the crisis.

States need to recognize that Ebola is a tragic example of the need to find comprehensive solutions to address forgotten and neglected diseases. Research and development and financing for new treatments must be based on the needs of people, not on returns on investment and profit. Findings and new treatments should be considered global public property tailored to the needs of patients, health workers, and states. This must be done in tandem with renewed efforts to build strong and effective public health systems.

The Ebola epidemic between 2014 and 2016 is an extreme case—a textbook example—of all that can go wrong. It must not be repeated. The world needs strong leadership and political will to ensure that the global health system can never fail on such a scale again.