If there is a crisis on the border, cooperation is a better option than sealing it off.

That’s the lesson that President Harry S. Truman taught the nation in 1947, when a crisis in Mexico threatened to spread north and destroy the American cattle industry. Cattle owners and state governments wrote the president begging the federal government to build a fence and seal the southern border. But he refrained.

Instead, the Truman administration worked closely with the Mexican government to end the crisis before it could spread beyond Mexico. Although they initially settled on an anti-democratic plan to tackle the problem, the eventual solution engaged stakeholders and adopted democratic principles that obviated any need for the fence. The 1947 crisis reminds us that if we actually wish to handle the refugee crisis that is again creating demands for a fence, we must work to solve the underlying causes driving people to emigrate.

The cause of the crisis in 1947 was an outbreak of foot-and-mouth disease, known as aftosa in Spanish. The disease had previously never established itself in North America, in part thanks to several expensive extermination campaigns. When the disease appeared in Vera Cruz, Mexico, in December 1946 in cattle imported from Brazil, it set off a large-scale disaster with continental implications. After arriving, the disease spread rapidly in central Mexico, reaching the other side of the country in less than two months.

The characteristics of foot-and-mouth disease shaped the outbreak. The highly contagious yet rarely fatal disease is caused by an aphthovirus that aggressively seeks out and infects cloven-footed mammals such as cattle, oxen and pigs. After infection, the virus incubates for up to 12 days before symptoms show.

Among its symptoms in livestock is weight loss, which made the virus a potential national emergency. American cattle owners feared that, if the disease made its way north, it would become too expensive to bring cattle up to slaughter weight. That posed a genuine threat to the domestic beef industry. As Agriculture Department official S.O. Fladness said at a congressional hearing, “I do not see how the feeding industry could survive under conditions of foot-and-mouth disease.”

To U.S. cattle owners, the solution was obvious. They demanded that the government build a border fence to keep infected cattle from crossing into America.

This push spurred Truman to action, but not in the way the cattlemen wanted. Instead, agricultural officials from the United States and Mexico invoked a treaty signed 15 years earlier that allowed the two countries to cooperate to eradicate the disease wherever it appeared. Truman agreed to a request from Mexican President Miguel Alemán Valdés that the two countries create a joint eradication campaign.

Domestic opposition was fierce. Cattlemen and ranchers saw the campaign as an insufficient solution to a genuine crisis. Ranchers and their representatives demanded that the USDA add Mexico to the list of countries known to harbor the disease, thus shutting off historically important livestock and meat trade between the countries, while also beginning construction on a fence. So intense was the panic that cattle owners such as Richard Kleberg of Texas’s King Ranch wanted the border sealed even though they had financial connections to the cattle industry in Mexico.

The situation was so desperate, and farmers and ranchers so anxious, that even the USDA’s leadership demanded a fence.

Truman and his Cabinet, however, resisted. They realized that sealing a land border is a poor safeguard against the spread of a disease. Working with the Mexican government to eradicate the disease in central Mexico offered a far better prospect for keeping the disease out of the United States. The immediate goal was to contain it to the regions where it had taken root and then eradicate it before it spread to the valuable cattle herds in northern Mexico.

The initial plan called for a technique called area eradication, which meant employing squads of veterinarians, workers and soldiers to clear an area by slaughtering all of the animals, burying them in a mass grave and reimbursing the owners. Funding came mostly from the United States, as did volunteer workers while Mexico provided the soldiers, local facilities and more volunteers. The program began working by the summer of 1947.

While more effective than a fence, mass slaughter was not without significant controversy because of its anti-democratic features. The governments devised the program without consulting the people of central Mexico, who resented having their livestock murdered to cure a disease that, to them, was only a nuisance. Because owners in central Mexico did not send their cattle to feedlots, the reduced weight gain did not threaten their livelihoods.

Resistance spread until it became deadly. Fearing the loss of their cattle and encouraged by the presidents’ opponents, residents of a small town in the state of Michoacan murdered a veterinarian and his six-member military escort. The killings shocked both governments, spurring exaggerated responses. A special envoy for Agriculture Secretary Clinton Anderson recommended that, because eradication had clearly failed, the fence had to be built immediately, and the military needed to actively patrol by airplane and strafe any animals wandering too close.

But by the end of 1947, this panicked reply gave way to cooler heads. Truman and Anderson responded to the fury over the slaughter of livestock not with a fence, but by adopting a third way. Encouraged by Mexican commission members and a lone U.S. official, Truman and Anderson agreed to adopt a vaccine-based program with limited slaughter.

Slowly but surely, the commission and its workers erased foot-and-mouth disease from central Mexico. Eradication cost the United States $135 million, far more than the initial $9 million budget allocated by Congress. But the campaign was a success, the crisis averted.

The fight to eradicate foot-and-mouth disease in 1947 offers real lessons for the current crisis at the border. Truman succeeded by flexibly abandoning a plan that was devastating the countryside and instead adopting a plan that better served local needs. The apocalyptic fears of 1947 reflected an actual emergency, but the desire to build a fence represented a surrender without even an effort to address the root cause of the problem.

Then as now, the fence offered the false promise of an easy solution to problems in other countries. Yet the only real solution was to address the crisis at its source. Today, that means developing programs that serve people instead of harming them. If the Trump administration wants to solve the crisis at the border, it needs to devise a policy that fixes the underlying problems that drive people to flee their countries in the first place. It must be a policy based on listening to their needs and addressing their concerns, or else it will only lead to more pain without any hope for a long-term solution.