It was 1881, and German chancellor Otto von Bismarck had a serious socialist problem. He’d passed the Anti-Socialist Law of 1878, which banned Social Democratic meetings, associations and newspapers, but he couldn’t remove the party outright from the Reichstag. The socialists still found favor with too many constituents.

The political climate of the era was a result of German unification, the period stretching across the 19th century and culminating in 1871, when 26 small states, principalities, duchies and territories formed the German Empire. But thanks to the German constitution, Bismarck didn’t have to worry about pleasing the populace; his chancellorship was approved solely by Wilhelm I. But with the European economy in free fall, a nearly successful assassination attempt on the kaiser, and a short-lived but bloody socialist uprising in France, Bismarck was determined to undermine a party that he saw as a danger to the volatile new nation state. So the Iron Chancellor came up with a masterful plan: beat the socialists at their own game by offering health insurance to the working class.

“That was a calculation,” says historian Jonathan Steinberg, the author of Bismarck: A Life. “It had nothing to do with social welfare. He just wanted some kind of bribery to get social democratic voters to abandon their party.”

Bismarck didn’t care what the program—Krankenversicherungsgesetz—was called or how it was described, as long as citizens knew that the state—his state—coined the idea. “Call it socialism or whatever you like,” Bismarck said during the 1881 Reichstag public policy and budget debates. “It is the same to me.”

So in 1883, with the passage of the Health Insurance Law, Bismarck made Germany into a welfare state—all to stymie the socialists. The law was the first national system in the world, Steinberg says. Both employers and employees paid into insurance funds, and the German government verified workers’ enrollment by comparing employer records with fund membership lists, threatening employers of uninsured workers with fines.

Over the next several decades, the initial law would be expanded with accident insurance (1884), disability insurance (1889) and unemployment insurance (1927)—and before long, the rest of Europe had taken note of Germany’s program. (Great Britain, for example, went in a different direction; its health care laws stipulated treatment be financed by the government through taxes.)

Bismarck’s insurance scheme wasn’t an entirely original idea. European governments had implemented public health measures since the 14th century, when the Italian city-states took measures to control the spread of bubonic plague through quarantines. And community organized health insurance groups—called “mutual societies” or “sick funds”—appeared around the same time in certain professions. Miners in Bohemia, for example, had Knappschaftskassen, whose members paid into a common pot. The money went towards hospitals and the care of widows and orphans of miners killed in work accidents. The idea only grew in popularity during the Industrial Revolution, which dramatically reshaped the workforce. By the time Bismarck got around to his proposal five centuries later, 25 to 30 percent of workers in northwest Europe had sickness funds.

“Factory work harmed worker health. There was a demand for healthcare that they needed to finance,” says John Murray, an economist at Rhodes College and the author of Origins of American Health Insurance: A History of Industrial Sickness Funds. “But a key part of the Industrial Revolution that’s overlooked is that once workers got paid in cash once a week or every few weeks, they had cash that could be spent on what we would call health insurance.”

In other words, the availability of currency in densely populated cities made it logistically much easier to organize sickness funds. Farmers and workers like domestic servants were often paid with the goods they produced or in room and board rather than with cash, which made paying into a sickness fund much more complicated.

Those hurdles in the way of universal coverage remained unsolved under Bismarck’s law. Anyone who earned a living through in-kind compensation (like farmers) weren’t required to join the insurance groups. But as the population grew in cities, coverage boomed. In 1885, the enrollment was 4.3 million Germans; by 1913, that number had jumped to 13.6 million. And this came with a number of surprising repercussions.

In the 19th century, Germany had been one of Europe’s largest labor exporters, with more than 1 million leaving the country between 1851 and 1860 alone. Most made the U.S. their destination. “At the time, the combined effects of industrialization and the war against France had heightened a new sensitivity to the consequences of migration, both in economic and military terms,” writes economic historian David Khoudour-Castéras. By providing workers with government-mandated health insurance—something they couldn’t find anywhere else—Germany made itself more appealing to its citizens. Emigration decreased dramatically in the years leading up to World War I, in part because workers could take sick days if they stayed in Germany.

Meanwhile, the United States only started organizing mutual funds in the 1870s, and workers compensation in industrial accidents was limited before World War I. It wasn’t until the Social Security Act of 1935 that the federal government got involved in a meaningful way, and even then most health insurance was employment-based, not unlike the Bismarck system but without the government mandates. As Khoudour-Castéras writes, “The level of protection of American workers against the main threats… was very low before the Great Depression and virtually nonexistent before World War I. By contrast, most German workers were covered by social insurance mechanisms by 1913.”

As for the German economy, it did grow in the decades after Bismarck’s law passed; whether that was a direct response to the increasing number of people covered by insurance is hard to say. “Yes, there was a correlation, but it’s not clear to me whether the growth caused greater insurance coverage or the other way around,” Murray says. He adds that part of the benefit to the economy and the government was that with insurance, workers who fell sick were less likely to fall into poverty and strain the government’s poor law institutions.

But did Bismarck’s new insurance actually improve worker health? According to economists Stefan Bauernschuster, Anastasia Driva and Erik Hornung, it did. Between 1884 and the end of the century, blue collar worker mortality rates fell 8.9 percent, they write in a recent study. “Surprisingly, the insurance was able to reduce infectious disease mortality in the absence of effective medication for many of the prevailing infectious diseases.”

The German model evolved over the 20th century, but remained effective and popular. When the system was exported to the Netherlands, Belgium and France during World War II, each of the countries kept the model, despite the fact that it was imposed under Nazi occupation.

All told, Bismarck’s system was a massive success—except in one respect. His goal to keep the Social Democratic Party out of power utterly failed. “The vote for the Social Democratic Party went up and by 1912 they were the biggest party in the Reichstag,” Steinberg says. Perhaps fortunately for Bismarck, he wasn’t around to see their rise. He died in 1898 without another chance to remove the socialists from power.

That Bismarck was able to create the system at all is thanks to a series of unlikely events, Steinberg says. After all, Bismarck only remained in power long enough to establish the law because of the longevity of Wilhelm I—who survived multiple assassination attempts and lived to be 90 in a period when the life expectancy was around 40. If the kaiser had died sooner, his heir would’ve immediately replaced Bismarck, probably with a less conservative chancellor, and who knows what would’ve happened with the healthcare law.

“[The insurance law] was manipulative, clever, worked well, and left a great inheritance,” Steinberg says. “But I think Bismarck never cared much that he was the founder of the welfare state in Germany.”

Editor's note, July 17, 2017: This article has been edited to clarify the type of government established in Germany during unification. Germany did not become a republic until after World War I.