Image caption Child at a Black Lives Matter demo in Chicago

The phrase "Black Lives Matter" was already hotly debated - and that was before it was reportedly used by the suspect who is thought to have killed five police officers during a sniper attack in Dallas.

Over the past three years, a powerful hashtag and movement has grown up to protest against police killings of black people in America.

More than 1000 people were killed in police operations in the US in 2015, nearly a third of them black - despite the fact that black people are 13% of the population. A protest movement has grown up against that. But it is a complex, amorphous group: both a formal organisation and, at the same time, a vast informal collection of ordinary people who tweet the slogan Black Lives Matter.

The hashtag surges with each new case of a police killing of a black person that is seen as unjust, usually after a video emerges. This week it surged twice - with the fatal shootings of Philando Castile in Minnesota and Alton Sterling in Louisiana.

Each time it surges, mostly peaceful protesters come out in US cities to declare that "Black Lives Matter". It's such a powerful rallying cry that some have controversially likened it to a reborn US civil rights movement. That's what was happening in Dallas on Thursday night - a peaceful Black Lives Matter protest - until suddenly, it was anything but. The sniper fire at that protest eventually led to the murder of five Dallas police officers and the wounding of seven more. Two civilians at the protest were also wounded.

And now, the phrase Black Lives Matter is suddenly on everyone's lips - and not in the way its supporters would like.

Deleted tweet

We'll never get the chance to interrogate the suspected gunman, named by US media as Micah Johnson, 25, about the extent of his actual links to the Black Lives Matter movement - he was killed at the scene. But comments by Dallas Police Chief David Brown have now linked him clearly to the slogan. "He said he was upset about Black Lives Matter [protest movement]; he said he was upset about the recent police shootings," Mr Brown told a news conference.

The response online was an angry one. For example, this: "Watch out black lives matter punks. Real America is coming after you". These are the words, on Twitter, of a former Republican Congressman Joe Walsh, on the Tea Party right.

Image copyright TWITTER

His words were widely criticised - but also shared. He has since deleted them and made clear he does not support violence.

It's an extreme example, but more general frustration with the Black Lives Matter is a major preoccupation of a large and vocal group on social media. There are rival hashtags, such as "Blue Lives Matter" - in support of police - which have surged since the Dallas shootings.

An even bigger rival hashtag is "All Lives Matter" which is used by people to take the focus away from black people alone as victims.

So bitter are these disagreements that President Obama himself weighed in to the debate on Friday after Dallas. "When people say black lives matter, it doesn't mean blue lives don't matter, it just means all lives matter, but right now the big concern is the fact that the data shows black folks are more vulnerable to these kinds of incidents," he said. "This isn't a matter of us comparing the value of lives."

He added that "anyone involved in these senseless murders will be held fully accountable".

History of a hashtag

Black Lives Matter began in 2013, after an activist in California named Alicia Garza wrote a post on Facebook. "Black people. I love you. I love us," she wrote. "Our lives matter."

Image caption These demonstrators in a Chicago street are protesting police shootings

She was furious that George Zimmerman - not a police officer, but a volunteer for a neighbourhood watch scheme - had been cleared of the murder of a black teenager, Trayvon Martin. She and two others started using the phrase "Black Lives Matter" as a hashtag online.

The idea gained some traction among activists. But the wider world might not have noticed if it weren't for events in a suburb of St Louis, Missouri in 2014. In August of that year Michael Brown, a black 18-year-old, was shot dead by officer Darren Wilson.

Wilson was never charged over the killing because a grand jury, and a federal investigation, saw merit in his claim of self-defence. Despite that, Michael Brown's death unleashed a deeper anger about racial injustice in policing. There were protests, civil unrest and the hashtag Black Lives Matter surged across the country.

And that was only the first time. The protest movement has grown - both formally and informally - with each controversial case of a police killing that has emerged.

For all its radicalism - and the descent of some protests into unrest - it has been essentially a peaceful movement. So how are online activists reacting to the violent events in Dallas?

Condemnation and fear

"Can't let them distort the message, or try an say that BLM represents anything other than peace & equality!" says one widely retweeted remark. "#BlackLivesMatter advocates dignity, justice and freedom. Not murder," says another.

Image copyright Twitter / facebook

Image copyright KING ANTHONY

"What is going on is horrendous," rapper Moisey Morancy told BBC Trending. "My heart goes out to the police officers who are here to serve and defend us," he said. "Not all police officers are bad."

But Morancy, like others, echoed concern about the future - and that the killing of police officers will overshadow the aims of the protest movement. "It's going to give bad police officers an excuse to shoot us," he said. He is worried the tension between police officers and black people may escalate. "They are going to wage war and there are going to be more deaths," he said.

You can follow BBC Trending on Twitter @BBCtrending and Facebook. All our stories are at bbc.com/trending