On Thursday night, a mass shooting happened in Dallas. Five human beings were killed, and seven wounded, by one or more people with a gun.

According to the Dallas Police Department, the shooter (or shooters) deliberately targeted Dallas law enforcement officials, sniper-style, and also shot two civilians.

The shooting occurred at the tail end of a rally in response to the killings by police of Alton Sterling in Baton Rouge, Louisiana, and Philando Castile in a suburb of St. Paul, Minnesota — both black men who had guns with them when they were killed, but did not appear to be brandishing them or violating any gun laws.

The protest did not cause the ambush. The suspect named by police, Micah X. Johnson, is not affiliated with any group in any way. But the killings of Castile and Sterling should be a reminder: You can’t talk about guns in America without talking about race.

The Dallas ambush sits at the intersection of two of the primary stories America tells about guns today: as a protection against tyranny (or a threat to government), and as a threat to public order (or a tool for self-protection). But it also showed how different those stories can be depending on the race of the person holding the gun, or at whom the gun is pointed.

This week has encapsulated the ugly truth of guns in America: that black Americans with guns are most often seen as a threat, while black Americans are the ones most threatened by guns.

Black men aren’t always granted the right to be responsible gun owners

Philando Castile legally owned a gun. He had a concealed carry permit, issued by the state of Minnesota, for that gun. And (according to his partner, Diamond Reynolds) when he told a police officer during a traffic stop Wednesday night that he had a concealed carry license, and reached for his wallet to get it, he was shot dead.

The fact that Castile’s death didn’t inspire an official statement from the National Rifle Association has drawn outrage, but it’s also not surprising. The NRA’s history makes it more likely to protect white gun owners who see black men with guns as threats. (Indeed, it’s surprising that the host of the NRA’s podcast did criticize police for shooting Castile.)

The night before Castile’s death, Alton Sterling was killed by police in Baton Rouge. Sterling, unlike Castile, probably didn’t own his gun legally (he was a convicted felon, and Louisiana law bars most convicted felons from owning guns). But open carry of guns is legal in the state of Louisiana, and the police who killed him had no way of knowing when they shot Sterling that he wasn’t following the law.

A video taken by a witness, which appears to show police removing a gun from Sterling’s pocket after killing him, seemed to confirm many black Americans’ long-held suspicion: that police (and white civilians), automatically threatened by the bodies of black people, think of a “black man with a gun” as a threat no matter what that gun is for.

When guns are a protection against “tyranny,” police aren’t always threatened

In theory, the right to bear arms is enshrined in the US Constitution — for all citizens. In theory, that right exists to prevent against government tyranny: The Second Amendment begins by saying that “a well-regulated Militia, being necessary to the security of a free State.”

Given that the Constitution was written only a few years after the United States conducted a successful armed rebellion against a “tyrannical” colonial power, the connection makes sense. In the year 2016, it’s much more complicated.

The idea that guns are supposed to be a protection against “tyranny” — that the American government is, on some level, the biggest threat to the lives of Americans — tends to be associated with the right-wing militia movement, like the group of ranchers that took over an Oregon wildlife preserve earlier this year.

But it’s also been a feature of a strain of black radicalism, personified by the Black Panthers in California in the late 1960s and early ’70s. As Adam Winkler wrote in a 2011 article for the Atlantic detailing “The Secret History of Guns”:

Guns became central to the Panthers’ identity, as they taught their early recruits that “the gun is the only thing that will free us—gain us our liberation.” They bought some of their first guns with earnings from selling copies of Mao Zedong’s Little Red Book to students at the University of California at Berkeley. In time, the Panther arsenal included machine guns; an assortment of rifles, handguns, explosives, and grenade launchers; and “boxes and boxes of ammunition,” recalled Elaine Brown, one of the party’s first female members, in her 1992 memoir.

In general, this ideology doesn’t materialize into lethal threats to actual employees of the US government. No law enforcement officers were killed in the Oregon standoff; the Black Panthers may have taken over the California Capitol, but they didn’t shoot anyone to do it. The Dallas ambush was a more lethal threat to government officials, even though it wasn’t affiliated with an ideological movement.

Nonetheless, many Americans (both police and civilians) are animated by the belief that police are a specific target of violence — and that whenever they go out on the beat, they’re at risk of ambush. And those fears tend to be reinforced, in particular, by the threat of black men with guns.

The Black Panthers’ use of open carry to demonstrate to police that they were standing up against “tyranny” inspired California to make open carry illegal — and helped spur a nationwide wave of gun control. The rise of the Black Lives Matter movement, and associated protests against police brutality, has spurred fears of retaliatory attacks on law enforcement since they started.

Actual attacks on police only reinforce that fear: After the killing of officers Wenjian Liu and Rafael Ramos in New York in 2014, one police union reportedly sent out a message to officers telling them to take two squad cars out on any call so they’d be able to respond to threats. “These are precautions that were taken in the 1970s when police officers were ambushed and executed on a regular basis,” the email read.

During a press conference after the Dallas ambush, Mayor Mike Rawlings took the opportunity to defend police using military equipment like body armor: “The chief makes decisions at times that people could be critical of: ‘Do you put too much body armor on?’ If we are being critical of these things, think about today. This is what you're risking if you don't do it right.”

The debate about whether guns protect or threaten public order often centers on white gun owners

Most gun owners don’t own guns so they can fight the government. Historically, groups like the NRA have defended gun ownership by talking about hunters and sportsmen.

“I do not believe in the promiscuous toting of guns,” the NRA president told Congress in 1934.

But since the late 1960s and ’70s, defenders of gun rights have seen gun ownership as an individual right — and one they’ve been extremely wary of any government attempt to regulate. (Thus our current, incredibly polarized and sclerotic gun debate.) In particular, though, they’ve come to see it as a way to protect themselves against threats to public order: against crime.

As Evan Osnos writes in a recent New Yorker feature about the history of the gun industry:

In 1972, Jeff Cooper, a firearms instructor and former marine, published “Principles of Personal Defense,” which became a classic among gun-rights activists and captured a generation’s anxieties. “Before World War II, one could stroll in the parks and streets of the city after dark with hardly any risk,” he wrote. But in “today’s world of permissive atrocity” it was time to reëxamine one’s interactions with fellow-citizens. [...] Adapting a concept from the Marines, he urged civilian gun owners to assume a state of alertness that he called Condition Yellow. He wrote, “The one who fights back retains his dignity and his self-respect.”

The NRA didn’t create this shift, but it became the vehicle for it, as Osnos writes: “in 1977, at the N.R.A.’s annual meeting, conservative activists led by Harlon Carter, a former chief of the U.S. Border Patrol, wrested control from leaders who had been focussed on rifle-training and recreation rather than on politics, and created the modern gun-rights movement.”

“The only way to stop a bad guy with a gun is a good guy with a gun” isn’t just a cute saying — it’s the reason that millions of Americans bought guns during the crime wave of the 1960s to ’80s. That was especially true for white Americans. The fear of crime as a political and social force in America (as scholars like William Stuntz and Jonathan Simon have detailed) was largely a fear by white suburbanites of high-crime, largely nonwhite cities. The face of crime (or hands, as in the Willie Horton ad) was black.

But over the past 20 years — as crime has declined consistently — the question of gun rights has often come up in the context of mass shootings. During the Obama administration, mass shootings and gun control debates have gone hand in hand: It’s very rare for the first to happen without spurring the second, and the second has only happened when prompted horribly by the first.

In the mind of gun control advocates today, guns aren’t primarily a safeguard of public order; they’re a threat to it. Mass shootings are seen as an epidemic; people who didn’t previously feel unsafe in their neighborhoods have started to express fears that they or their children will be killed. They mock the idea of the “good guy with a gun” by pointing to the week in April when four toddlers shot and killed themselves due to unsecured guns. The implication is that there’s no situation a gun doesn’t make more dangerous.

And while the face of crime in the US was black, the face of the mass shooter in the US is primarily white, young and male. That shapes how we talk about mass shootings: When the perpetrator of an attack is white, people are more likely to talk about his weapons than his ideology.

In 2016, gun owners see their guns as a way to protect public order; gun control advocates see guns as a threat to it. But in both of those cases, they imagine the person holding the gun is white.

When the person holding the gun is black, things are different.

How black Americans get left out of the gun debate

The irony, of course, is that black Americans are more likely than any other group to be killed by gun violence. And they’re the ones disproportionately likely to be killed in police custody — the ones to whom the government poses the most immediate threat.

If the right to own a gun in America is about protection against crime, black Americans need that right more than any other. If the right to own a gun in America is about protection from tyranny, black Americans need that right more than any other.

Conversely, if guns in America pose a threat to public order, they pose the biggest threat to black people. And if they pose a threat to government, that’s largely a white threat — the Black Panthers (at least as they existed in the 1960s) aren’t around anymore — but black communities are the ones police are often afraid of.

The fact is that black Americans stand, largely unheard, at the center of the debates over whether guns protect American values or threaten them. The trope of “black-on black-crime” has become a joke, because so many conservatives bring it up only in the context of other forms of violence. And the gun control advocates who talk about black crime victims often ignore the role that gun control plays in overpolicing: Stop-and-frisk, after all, was supposed to be a tool for the NYPD to confiscate illegal guns.

At some level, the debate over the killings of Philando Castile and Alton Sterling are a debate about who gets to be safe in America. So are debates around mass shootings. But the answer, all too often, is that black people — no matter which end of a gun they’re on — don’t have the right to be safe.