On the evening of June 2, 1919, an anarcho-communist named Carlo Valdinoci detonated a bomb in front of Attorney General A. Mitchell Palmer’s home on R Street in northwest Washington, D.C. Only Valdinoci himself died in the explosion. The ensuing government response to the attack, however, offers lessons relevant to law enforcement 100 years later.

Valdinoci, for his part, was a follower of agitator Luigi Galleani, who preached that murdering political leaders, business titans, and other “oppressors” would spark an anti-capitalist revolution. That year, Valdinoci’s fellow Galleanists launched the first modern international terrorist campaign to hit the United States. The bomb intended for Palmer was one of seven that exploded the same day and followed a larger mail-bombing campaign that took place earlier that year.

The attorney general’s response — a series of searches, arrests, and deportations called the “Palmer Raids” — led directly to the creation of the modern national security apparatus. The man leading the effort was J. Edgar Hoover, who later rose to serve as head of what became known as the Federal Bureau of Investigation, a position he held from 1924 until his death in 1972. The raids targeted not only Galleanists and their sympathizers, but all manner of far-left individuals, most of them Italian and eastern European Jewish immigrants.

Few of the groups targeted had violent intentions. In fact, officials selected many of the raid targets, and nearly all of those living west of the Mississippi River, primarily to elevate the operation and make it appear national in scope. Even by the relaxed standards of the 1920s, federal agents were brutal in their approach, often recklessly violating raid targets’ rights. Although a few hundred of those arrested were deported, most had done nothing wrong and were ultimately released.

In their particulars, then, the Palmer raids failed on nearly every account. Galleanists continued their violence, including a 1920 Wall Street bombing that killed 38 in New York City’s deadliest terrorist attack until the Sept. 11 attacks. While originally popular, the arbitrary nature of the operation ultimately rendered it a political disaster. Palmer, once considered a contender for the presidency, saw his public career wither.

In hindsight, the reasons for these failures seem obvious: Hoover’s team had no high-level informants in the radical anarchist movements, or even in the communities from which they recruited. Near-random searches and arrests of innocents turned off people who might otherwise have helped identify real threats. And even if it had wanted to, the tiny team Hoover headed lacked the resources, personnel, and technology to discover the full extent of the bombing rings or carry out effective anti-terrorist efforts.

But this doesn’t mean everything that started with the Palmer raids was pointless. The Galleanists’ continuing violence showed that they were dangerous and, given their transnational nature, probably couldn’t be stamped out by local police. And Hoover’s FBI, for all its numerous, well-documented faults, did eventually become capable of disrupting serious threats. In the run-up to World War II, for instance, the agency disabled both pro-Nazi, German cells and their Japanese militarist counterparts. Interestingly, Hoover was one of the few high-level officials to oppose President Franklin Roosevelt’s internment of ordinary Japanese civilians.

Moreover, the FBI introduced to law enforcement then-new techniques, such as fingerprinting, and even collected the first national crime statistics. Later on, during the opening years of the Cold War, it also infiltrated the Moscow-funded Communist Party USA and ferreted out important Soviet agents, such as Julius Rosenberg and Alger Hiss.

Still, the lessons of the Palmer raids remain incompletely learned a century later. The world is a dangerous enough place to render necessary a permanent law enforcement and national security apparatus with real powers to disrupt terrorists and foreign state actors.

Sweeping attacks on Immigration and Customs Enforcement from the Left and on the FBI from the Right, therefore, are equally irresponsible.

However, if law enforcement is to appropriately infiltrate harmful groups without limiting the exercise of our constitutional rights, then building the types of effective relationships with immigrant and other marginalized communities that the Palmer-era Justice Department lacked isn’t just a good idea, it is crucial. The intelligence these relationships can garner is key to targeting those who genuinely wish to harm the public while sparing those who, however radical in their views, lack criminal intentions. In addition, fighting sophisticated terrorists also requires good technology, up-to-date techniques, robust oversight, and real accountability — all things the Palmer era lacked.

An America that can learn the lessons of the Palmer raids will be far safer and much more secure.