In the 1500s, Chinese imperial officials tried to Make China Great Again—or at least solidify their control over the empire—by vigorously prohibiting international trade. One of the unintended consequences? Increases in pirate raids on coastal cities. This 16th-century Chinese example shows us how people responded to trade restrictions specifically and how they respond to changing returns to productive and predatory activity more generally.

A 2014 study published in the Journal of Economic History by James Kai-Sing Kung of the Hong Kong University of Science and Technology and Chicheng Ma of Shandong University tells the story statistically. Between 1550 and 1567, when the Chinese government cracked down on illegal foreign trade, the number of pirate attacks increased from about one per year to about thirty per year, and the increase was especially pronounced in silk-producing areas.

Before going into piracy, many pirates had been merchants. Once foreign trade was legalized in 1567, they went back to being merchants. A “sea ban” had been enacted in 1368, but it was not been enforced very vigorously. Trade proceeded until 1550, when a crackdown led to the destruction of some 1200 boats and the deaths of hundreds of smugglers and traders. To make the prohibitions stick, the imperial authorities organized people into ten-household groups charged with monitoring one another. If anyone was caught violating the trade prohibitions, everyone in the group would be executed.

This did a pretty good job of making people a lot less willing to break the law and participate willingly in foreign trade. It didn’t stem the demand for Chinese products, though, and the black market merchant enclaves off the coast where people would go to trade surreptitiously became pirate enclaves from which former merchants launched raids against coastal cities where they could get their hands goods for which there was a large foreign market—silk in particular.

Changing incentives changed how people made their livings. The merchants switched from procuring their wares by trading to getting them by raiding. Frederic Bastiat, it seems, was right: when goods don’t cross borders, armies will—or if not armies, pirates—and what would be an opportunity for everybody to be made better off becomes a fight over a fixed amount of wealth in which at least some people lose in the short run and likely everyone loses in the long run. Fortunately, Chinese authorities eventually backed off in response to the explosion in piracy. Piracy then fell, and the pirates became merchants again.

So what about today? I doubt we’re going to see eyepatch-wearing peg-leg pirates setting up in the Channel Islands and sacking Los Angeles and San Diego periodically because of tariffs on steel and cars, but the increase in piracy in mid-16th century China still has lessons to teach us. First, it shows us how trade moves into the black market and tends to be carried out by people who are unusually skilled in crime when it is legally prohibited.

Second, it shows us how changing incentives encourage people to move from wealth creation to wealth destruction. The merchants who were trading switched to raiding. The people who were making money making cars or steel or literally anything else switch to making money by raiding the pockets of taxpayers and consumers who now have to pay more for protected domestic goods.

Third, it shows us how restrictions on international trade reduce a country’s wellbeing. The “sea ban” cut off coastal Chinese citizens’ options and made it harder, therefore, for them to adjust to things like famines and population growth.

More than anything, this is another example of how the law of unintended consequences rears its ugly head. Did the Chinese government want to increase pirate raids on coastal cities? I seriously doubt it, but it’s not enough to make policy based on daydreams about how the policy will work. This was true in sixteenth-century China just as it’s true today—and just as it will be true tomorrow.