The data were processed to standardize key variables and exclude more than 200,000 cases that lacked essential information or were homicides by the police. The resulting data detail the circumstances of each death: any weapons used; information on the killer’s and victim’s race, age, ethnicity and sex; and how police investigators classify each type of killing (“brawl due to the influence of alcohol,” “sniper attack” or “lover’s triangle,” for example).

Little large-scale research has examined the role of race in “justifiable” homicides that do not involve the police. The data examined by The Marshall Project are more comprehensive and cover a longer time period than other research into the question, much of which has focused on controversial Stand Your Ground laws.

In the United States, the law of self-defense allows civilians to use deadly force in cases where they have a reasonable belief force is necessary to defend themselves or others. How that is construed varies from state to state, but the question often depends on what the killer believed when pulling the trigger.

“If there are factors — even if they’re stereotypes — that lead the defender to believe he’s in danger, that factors in, whether it’s a righteous cause or not,” said Mitch Vilos, a Utah defense lawyer, gun rights advocate and the author of “Self-Defense Laws of All 50 States.”

Self-defense decisions by regular people, much like those involving the police, are made quickly and with imperfect information. As a result, a homicide can be ruled self-defense when the killer faced no actual threat but had a reasonable belief he or she did.