Once upon a time, the United States signed a trade treaty with its neighbor that reduced taxes on goods traded between the two countries. The tariff reductions allowed trade between them to boom, more than doubling in a little over 10 years. But protectionist murmurings in America gradually grew into a chorus, suggesting that the other side was benefiting disproportionately from the deal. So the U.S. tore up the treaty, igniting a tariff battle.

As they say in Quebec, déjà vu. The country in question is Canada, and the year is 1866. To be precise, the so-called Reciprocity Treaty had actually been signed between the United States and Britain (the provinces that would later form the nation of Canada were still British possessions at the time). It allowed those territories tariff-free access to the U.S. market for their natural resources in exchange for providing Americans with extended fishing rights. The final straw for the U.S. in abandoning the 1854 treaty had been political — protesting the tacit support that the British had shown to the Confederacy during the Civil War. It also helped that some Americans thought that inflicting economic hardship on those north of the border could coerce them to “come within the magic circle of the American Union,” as then–Secretary of State William Seward put it. On the contrary, the move prompted Canadian Confederation — the unification of the colonies as the Dominion of Canada.

One of the great ironies of American tariff politics is that protectionism, if the other country responds with tariffs of its own, can actually lead to outsourcing. Marc-William Palen, University of Exeter

The two countries subsequently exchanged escalating rhetoric and trade restrictions for decades: Conservative John A. Macdonald, the first prime minister of Canada, instituted the retaliatory National Policy in 1879, promising to pay back the U.S. “in their own coin” (read, a 35 percent tariff on manufactured goods). The U.S. counterpunched: Secretary of State James G. Blaine was “teetotally opposed to giving the Canadians … the actual remuneration of American markets,” and so raised import rates to almost 50 percent. A Canadian general election reaffirmed public support for Macdonald’s protectionist National Policy, and the Americans would soon up import taxes again … and thus the tit-for-tat trade battle continued.

Fast-forward more than 100 years, and the United States is again on the verge of kick-starting trade battles. In response to President-elect Trump’s threats to impose tariffs on Chinese imports to discourage the outsourcing of American manufacturing jobs, a recent editorial in the Chinese state-run newspaper warned of “countermeasures.” And it’s not just China: Trump has repeatedly singled out for criticism companies that have moved production to Mexico. Even trade relations with Canada, which took almost a century to heal after the last North American tariff battle, could be at stake if NAFTA gets the Trump treatment. “There’s a lot of echoes in terms of the trade war in the 19th century and the 21st century,” says Trent University’s Dimitry Anastakis, chair of the Canadian Business History Association.

So how did it all play out last time? Somewhat counterintuitively, after the U.S. abandoned the Reciprocity Treaty, several American companies actually moved manufacturing operations to Canada to gain tax-free access to the Canadian market. By the late 1880s, at least 65 American manufacturers, including Singer Manufacturing and Ford Motor Co., had hopped the border, often creating Canadian production outposts under a “branch plant model,” says Anastakis. These companies brought industrialization, employment and living standards to Canada that would likely not have developed organically, he explains. “One of the great ironies of American tariff politics,” says Marc-William Palen, a trade historian at the University of Exeter, “is that protectionism, if the other country responds with tariffs of its own, can actually lead to outsourcing.”

Of course, there are no guarantees that will happen again. The world economy has changed beyond recognition, as have the countries in question, notes Palen. But, as Anastakis points out, it does go to show that “you never know how [tariff battles] are going to play out,” largely because the ultimate consequences depend on the actions of other governments, as well as private corporations. In the 19th century, it made sense for companies to relocate, because a Canadian manufacturing base meant access to the entire British Empire tax-free. In the 21st century, the same might be true as China positions to lead a Pacific free-trade deal in place of the U.S.-led Trans-Pacific Partnership, guaranteeing more global market access than a protectionist United States. The saving grace for protectionists in an otherwise globalized world is relying on domestic demand to drive domestic production; the United States’ homegrown consumer market is indeed vast, which could limit any capital flight today just as it did 150 years ago.

So who knows what unintended consequences might arise from a fresh American trade battle? Trump and his supporters hope it could provide a renaissance to domestic manufacturing — indeed, American industry hardly struggled in the late 19th century — but don’t be surprised if more American companies set up shop in China, Mexico or, yes, even Canada.