On Sunday morning, three police officers were shot dead in Baton Rouge. This attack came just 10 days after five police officers were killed in Dallas. Both events were revenge attacks for the killing of young black men by police.
The bloodshed has shocked the US, leading President Barack Obama to call for calm. But how many police officers are killed in the US in a normal year? And how many people are killed by police?
"There's a widespread perception in the American public, and particularly within law enforcement, that officers are more threatened, more endangered, more often assaulted, and more often killed than they have been historically," says Seth Stoughton, a law professor at the University of Southern Carolina and former policeman.
"I think it's a very strong perception. People truly believe it. But factually, looking at the numbers, it's not accurate," he says.
FBI data on police officers "feloniously killed" - killed as a result of a criminal act - indicates that the numbers have been falling, he says.
Looking at the 10 years from 2006 to 2015 the annual average number of police deaths was 49.6, Stoughton says, which he notes is "down significantly from the high".
"The high was the 10-year period prior to 1980, when we had an average of 115 - actually 114.8 officers feloniously killed… in the line of duty every year."
At the same time the number of police officers has increased dramatically in the US.
At the same time the number of police officers has increased in the US. There are a quarter of a million more police officers working today than there were three decades ago.
So when you consider the number of officers killed per 100,000, there has been a dramatic decrease. The annual per capita number of officers killed has dropped from 24 per 100,000 in the 10 years to 1980 to 7.3 per 100,000 in the 10 years to 2013 (the last year for which there is good data).
This chimes with a bigger trend, which is a steady reduction in crime, including homicides.
Killed by police
Official data on the number of people killed by the police turns out to be remarkably unreliable.
"We can't have an informed discussion, because we don't have data," FBI Director James Comey said in the House of Representatives in October.
"People have data about who went to a movie last weekend, or how many books were sold, or how many cases of the flu walked into an emergency room. And I cannot tell you how many people were shot by police in the United States last month, last year, or anything about the demographics. And that's a very bad place to be."
He had previously said it was "unacceptable" that the leading sources of this information were newspapers, the Washington Post and the Guardian.
Find out more
More or Less is broadcast on BBC Radio 4 and the World Service
Although the FBI does gather some data on fatal shootings, police forces are not obliged to provide it, and only some of them do. This led the Washington Post tostart tracking civilian deaths itself after the shooting of Michael Brown by police in Ferguson in August 2014, by monitoring reports in the media.
"We looked at the FBI database, since that was the official government accounting for things. And saw that over the past decade, the average number of shootings that they counted was about 400. By the end of last year, we had almost 1,000 fatal shootings that we had captured," says Kimberly Kindy, an investigative reporter at the newspaper.
Blacks are being shot at a rate that's 2.5 times higher than whitesKimberly Kindy, Washington Post
"What we didn't know though, of course, as we went into this year and did it a second year was - was last year a normal year? Is 990 people being killed by police in a single year about what you would expect year in and year out?"
So far, 2016 appears to be roughly on track with 2015, Kindy says.
"In fact there's been an increase, a 6% increase in fatal shootings when we compare the first six months of last year to the first six months of this year… So that's about three people are dying a day, who are being fatally shot by officers."
The Guardian has recorded even more deaths in 2015 and 2016, including deaths as a result of tasering, collisions with police vehicles and altercations in police custody.
The Washington Post journalists also collect information about the race of those shot by police. According to Kindy, about half are white, and about half are from minorities, but adjusting for the size of the populations, Kindy says, "minorities are definitely being shot at a higher rate than whites".
This is particularly noticeable in the case of the black population.
"Blacks are being shot at a rate that's 2.5 times higher than whites," Kindy says.
The big question is whether that is evidence that the police are discriminating against African Americans. There's an obvious argument that it is: African Americans are just 13% of the US population, and yet 26% of the people killed by the police.
But there's another way to look at these numbers. Nearly 50% of convicted murderers in the US are African Americans. Why that number is so high is a difficult question to answer. So is the question why African Americans are also far more likely than whites to be murder victims.
The point is that if African Americans are more likely to be involved in violent crime - both as perpetrators and victims - then the higher rate of police shootings may not be surprising.
The truth is that the raw statistics can't tell us whether the police are treating African Americans differently from white people. To understand that, we'd need to look at more details about what happened in each incident. There's a big difference between a case where someone was shooting at the police, and a case where someone was passive and unarmed.
One person who has tried to do that is an economist from Harvard University called Roland Fryer, the first ever African American to win the prestigious John Bates Clark medal in economics. This month Fryer released a preliminary study examining records from 10 cities and counties, with the best data coming from Houston - it's not yet peer-reviewed, but it has received a lot of attention in the press.
Fryer's research suggests that African Americans and Hispanics are substantially more likely to experience force in their interactions with the police - such as having a gun pointed at them, being handcuffed without arrest, or being pepper-sprayed or hit with a baton. This racial difference is reduced, but doesn't completely disappear, when Fryer adds all sorts of statistical controls such as whether the incident was indoors or outdoors, in a high-crime area, took place at night, and so on.
However, Fryer doesn't find any racial difference in the cases where police offers actually shoot someone.
The debate over this continues, both on the streets and in academia.