Today, revolutionary anarchists seem archaic, almost quaint. But for around 50 years, from the 1880s to the 1930s, anarchists carried out terror attacks all over the world. Buildings blew up; world leaders and random civilians alike were killed.

The parallels between then and now, when we face the threat of ISIS and other Islamic extremist groups, are many. During the decades of anarchist terrorism, it seemed like each week we heard of another incident carried out by an immigrant from a politically unstable region of the globe, and some prominent public figures called for banning all immigration from these regions. Anarchists were decentralized and self-defined (“self-radicalized” as the media puts it today). Also like ISIS—and unlike nationalist terror groups—anarchists did not have a clear political goal that could be a starting point for negotiations. This is what makes decentralized terror groups particularly dangerous: they have no demands with which we could comply or offer to discuss, even if we wanted to.

The first major incident in the U.S. was the Haymarket Bombing in Chicago in 1886, in which there were 11 deaths; the ensuing riots led to over a hundred arrests. Fifteen years later, President William McKinley was shot by anarchist Leon Czogolz. McKinley’s death was part of a wave of international assassinations, including those of Marie François Sadi Carnot, president of France, in 1894; Antonio Cánovas, prime minister of Spain, in 1897; the Empress Elizabeth of Austria in 1898; and King Humbert of Italy in 1900.

Scattered amongst these high-profile attacks were many smaller incidents for which anarchists claimed responsibility. The steady drumbeat of anarchist attacks in the U.S. was outpaced by outrages in Europe, which newspaper readers and newsreel audiences learned about on an almost weekly basis.

Anarchism was an ideology open to all, and there were plenty of student radicals in America claiming intellectual allegiance to Proudhon, talking up the proletarian uprising before graduating to a white-collar job. But those who went beyond “stick it to the man” tavern musings, who actually threw bombs, tended to be disaffected working-class men who brought their political ideologies from anarchist hotspots abroad.

Native labor-left groups also had radical elements, turning strikes into riots and carrying out their own bombings (such as the assassination of Frank Steunenberg in 1905 and the attack on the Los Angeles Times building in 1910). In the public mind, however, socialism, Bolshevism, and anarchism were understood as a continuum, and few of those not enmeshed in the factional world of the radical left were interested in parsing the differences. Leftist violence—even carried out by Americans—was blamed on pernicious foreign influences.

The First World War and the Russian Revolution particularly emboldened various radicals. In San Francisco, a bomber attacked on July 22, 1916—“Preparedness Day”—killing 10. The likely culprit was Alexander Berkman, a Russian immigrant and publisher of the anarchist newspaper The Blast. (Berkman had also served 14 years in prison for the attempted murder of Henry Clay Frick in 1892, and was eventually deported in 1919.)

In 1917, an anarchist bomb blew up a Milwaukee police station, killing 10—though the building had not been the intended target, as helpful citizens had found the device and delivered it to the police.

In June 1918, the House unanimously passed the Alien Anarchist Deportation Bill, which authorized the immediate expulsion of foreign nationals subscribing to anarchist politics. The bill also extended the ability of immigration authorities to remove foreigners who had been resident for more than five years, a group to whom earlier laws had offered greater protections. In a nation at war, legislators were keen to kick out German sympathizers—the term “anarchist” being conveniently flexible enough to mean “foreign subversive.”

The draconian nature of this legislation was apparently vindicated within a year, when 36 mail bombs were sent to prominent citizens between April and June 1919, including eight on June 2. This series of bombings led to what came to be known as the “Red Scare” of 191920, in which hundreds of political agitators were expelled, most to the newly Sovietized Russia.

But anarchist outrages continued. In April of 1920 was the robbery and murder for which Nicola Sacco and Bartolomeo Vanzetti, followers of Italian anarchist Luigi Galleani, were later convicted. In September came the Wall Street Bombing, in which 38 died, apparently carried out by Galleanists in retaliation for the indictment of Sacco and Vanzetti. Through the 1920s, bombs were also sent to U.S. embassies abroad.

Fortunately, many would-be attacks were botched. The typical anarchist was a political radical, not an explosives expert. Common were news stories of “anarchist bombings” in which the only person killed was the bomber himself.

Nonetheless, the danger posed by foreign agitators led to further legislation, focusing not just on expelling troublemakers, but also on stopping them from entering the country in the first place. The Emergency Quota Act of 1921 restricted immigration based on a formula of admitting only 3 percent of the number of residents from that country who had been living in the U.S. in 1910. (This applied only to Europeans, as Asian immigration was effectively banned under other laws, and no limits were placed on immigration from the Americas.)

Over the next two years, the steady stream of arrivals from Eastern Europe and the Mediterranean made some feel the law had not gone far enough. The Immigration Act of 1924 went further, limiting the quota to 2 percent and using the 1890 census as a baseline instead—which was, crucially, prior to the surge of Italian and Eastern European migration between 1890 and 1910. African immigration was also restricted, and Arabs and Asians were banned. As a result of the act, immigration from Italy fell more than 90 percent.

And anarchism did peter out. The last major attack in the U.S. was when Giuseppe Zangara, an Italian immigrant, tried to shoot President Franklin Roosevelt in 1933. He succeeded in killing Chicago Mayor Anton Cermak, who was beside Roosevelt. But anarchism as a political movement was killed off by changing global politics (and the Second World War), not immigration laws.

We now think of the Red Scare as anti-commie hysteria, and prominent figures like Emma Goldman have been largely rehabilitated in school textbooks. The immigration restrictions of the 1920s are regarded as simple racism, attitudes we should avoid repeating. That anarchist violence was real is conveniently forgotten.

But the fears of violence that drove these measures were part of a broader anxiety about immigration. The percentage of the U.S. population that was foreign-born peaked during the First World War at approximately 15 percent. As a result of the 1924 restrictions, which remained in place until 1965, this number was 4 percent by the early 1970s. Now, the proportion is approaching 15 percent again (indeed, may have surpassed it, considering that illegal immigrants are undercounted in the census). It may be no accident that political debates around immigration are particularly heated now, and possibly 15 percent is a psychological tipping point.

Today’s fears of Islamic terrorism have much in common with the anarchist crisis. Suggestions, such as Donald Trump’s, to ban Muslim immigration are not “un-American”; rather they are part of a long tradition of limiting access to the U.S. on racial, ethnic, or political grounds.

Katrina Gulliver is an historian and writer.