If you browse the gun-rights websites for only a few minutes, you’re sure to find the claim: “Gun control is racist.” The statement seems absurd: African Americans favor gun control at substantially higher rates than whites. The gun-fatality rate for blacks far exceeds that for whites. And one of the few places you can easily find virulent racist literature is at a gun show. In what bizarro world is gun control racist?

Actually, the gun-rights websites are on to something. As I discovered in researching my new book Gunfight: The Battle Over the Right to Bear Arms in America, for much of our history, gun regulation has been tainted by the stains of racism and discrimination. Today, the story is more complex than the simplistic slogans of gun-rights advocates. But there is no denying that racial politics have profoundly shaped America’s gun laws.

Gun-rights hardliners are fond of dismissing nearly any gun-safety effort as a violation of the Second Amendment. Yet the men who wrote and ratified that provision had extensive gun laws—and many of them were racially discriminatory. Not only did they support laws prohibiting slaves from possessing guns, they also disarmed free blacks, who the Founders feared might join together with their brethren in chains to revolt.

The fear of blacks with guns was one of the reasons behind the Supreme Court’s notorious decision in the Dred Scott case. Chief Justice Roger Taney’s opinion insisted that blacks could not be citizens because, if they were, they’d have all the protections of the Bill of Rights, including the right to “full liberty of speech... to hold public meetings on political affairs, and to keep and carry arms wherever they went.”

America’s most horrific racist organization, the Ku Klux Klan, began with gun control at the very top of its agenda. Before the Civil War, blacks in the South had never been allowed to possess guns. During the war, however, blacks obtained guns for the first time. Some served as soldiers in black units in the Union Army, which allowed its men, black and white, to take their guns home with them as partial payment of past due wages. Other Southern blacks bought guns in the underground marketplace, which was flooded with firearms produced for the war.

After the war, Southern states adopted discriminatory laws like the Black Codes, which among other things barred the freedmen from having guns. Racist whites began to form posses that would go out at night to terrorize blacks—and take away those newly obtained firearms. The groups took different names: the “Men of Justice” in Alabama; the “Knights of the White Camellia” in Louisiana; the “Knights of the Rising Sun” in Texas. The group formed in Pulaski, Tenn., became the most well-known: the Ku Klux Klan. Whites believed that they had to confiscate black people’s guns in order to reestablish white supremacy and prevent blacks from fighting back. Blacks who refused to turn over their only means of self-defense were lynched.

Overly aggressive gun control often sparks a backlash, and that’s exactly what happened after the Civil War. Determined to protect the freedmen’s rights, Congress passed legislation like the Freedmen’s Bureau Act and the nation’s first Civil Rights Act. As the former law stated, blacks were entitled to “the full and equal benefit of all laws... concerning personal security... including the constitutional right to bear arms.” When these laws proved ineffective, the Fourteenth Amendment to the Constitution was added, guaranteeing all Americans the “privileges or immunities of citizenship”—by which the drafters meant the protections afforded in the Bill of Rights, including the Second Amendment.

Today, we think of the National Rifle Association as a no-compromises opponent of gun control. In the 1920s, however, the NRA helped draft and promote restrictive gun laws in state after state—laws that were, in part, motivated by racism. Immigrants from Italy and Eastern Europe, who were known to carry around concealed pistols, were increasingly blamed for a spike in urban crime. Karl Frederick, the NRA’s president, helped draft the Uniform Firearms Act, model legislation that required a license to carry around a handgun. According to the law, only “suitable people” with a “proper reason” for being armed in public were eligible.

Police used this law as an excuse to keep disfavored minorities from having guns. His reputation for peaceful non-violence notwithstanding, Martin Luther King Jr. applied for a license to carry a gun in the late 1950s after his home was firebombed. The recipient of daily death threats, the civil rights leader clearly had good reason to carry around a gun to defend himself. Yet Alabama police exercised the discretion the law afforded them to deny King’s permit request.

Armed guards sought to protect King after that, and for a time guns were commonplace in his parsonage. William Worthy, a journalist who covered the Southern Christian Leadership Conference, reported that during one visit he went to sit down on an armchair and, to his surprise, almost sat on a loaded gun. One of King’s advisers, Glenn Smiley, called King’s home “an arsenal.”

In the late 1960s, Congress and numerous states passed a wave of new gun-control laws and, once again, race and racism were not far from the surface. In California, conservatives like Governor Ronald Reagan responded to the Black Panthers, who conducted armed “police patrols” to oversee how officers treated blacks in Oakland, by endorsing new gun laws to restrict people from having loaded guns in public.

In 1967, after Newark and Detroit suffered the worst race riots in American history, a federal report put part of the blame for the incidents on the easy availability of guns in urban neighborhoods. The next year, Congress passed the first federal gun-control law in decades. Among other things, the Gun Control Act of 1968 tried to restrict “Saturday Night Specials”—the cheap, easily available guns often used by urban (read, black) youth. The law, which was also supported by the NRA’s leadership, occasioned one critic to complain that the Gun Control Act was “passed not to control guns but to control blacks.”

Like the Black Codes and the KKK’s disarmament efforts, the gun-control laws of the 1960s also led to a backlash. In the 1970s, a hardline group of NRA members staged a takeover of the organization’s leadership and committed the NRA to aggressive political lobbying to defeat gun control. Ironically, it was laws intended to limit access to guns by black and urban radicals and supported by conservatives like Reagan that fueled the rise of the modern gun-rights movement, which is famous for being white, rural, and right-leaning. Some whites thought the government was coming to get their guns next.

In the years since, the racial politics of gun control have shifted dramatically. Given the high incidence of crime in some black communities, African-American politicians have sought measures to reduce gun violence. And it is primarily white politicians, representing white communities, that oppose gun control.

America’s most recent gun-control efforts, such as requiring federally licensed dealers to conduct background checks, aren’t designed to keep blacks from having guns, only criminals. Of course, the unfortunate reality is that the criminal population in America is disproportionately made up of racial minorities.

For all the wackiness you’re likely to find on some gun rights websites, they should serve as a reminder about the racist roots of gun control. There’s no doubt we need better and more effective gun safety laws. In pursuing them, we should be careful to avoid repeating the mistakes of the past.