This undated photo shows Micah Johnson, the suspected sniper after five police officers were gunned down in Dallas. Photo / AP
Military veteran Micah Xavier Johnson posted an angry rant against white people on a black nationalist Facebook group called Black Panther Party Mississippi last Saturday, denouncing the lynching and brutalising of black people.
Five days later, US authorities say, he took part in the sniper-style killing of five Dallas police officers.
"Why do so many whites (not all) enjoy killing and participating in the death of innocent beings," Johnson, 25, wrote in his Facebook post above a graphic video of people participating in a whale-killing, comparing it to the treatment of black people in the United States.
The Facebook group has over 200 members.
In what appeared to be Johnson's own Facebook page, he was portrayed as a black nationalist, with images of Black Power and the red, black and green flag sometimes known as the Black Liberation flag.
His profile photo showed him with his clenched fist in the air in the familiar Black Power salute. Johnson was also a military veteran who had served as a private first class in the US Army Reserve from March 2009 to April 2015.
He was deployed to Afghanistan from November 2013 to July 2014 and earned a number of service medals, according to Army records.
Much remained unknown about Johnson, and attempts to reach family members on Friday were not immediately successful.
It was not clear whether he was employed, though NBC News reported that he had been working for a company, Touch of Kindness, that assists mentally challenged children and adults.
Public records indicated he lived in Mesquite, a suburb of Dallas, and the Army also listed Mesquite as his hometown.
Johnson, who served in the Afghan war and said he wanted to "kill white people", took part in the attack in which five police officers were shot dead at a protest decrying police shootings of black men, officials say.
Seven other police officers and two civilians were wounded in the ambush in downtown Dallas on Thursday night (US time), officials said.
Police killed the gunman, identified by a US government source as Micah Xavier Johnson, using a bomb-carrying robot after an hours-long standoff.
The shooting sent swarms of protesters running in panic in the streets as police officers came under fire.
The shootings, the latest major gun violence to rock the United States, took place toward the end of a march protesting incidents earlier in the week in Louisiana and Minnesota in which police fatally shot black men in confrontations whose bloody aftermath was caught on video.
The Dallas shootings came during a week of heightened emotions over police use of force against black suspects and raised fears that others might seek to retaliate against police.
"This was a well-planned, well-thought-out, evil tragedy by these suspects. And we won't rest until we bring everyone involved to justice," Dallas Police Chief David Brown said on Friday.
"We are determined to not let this person steal this democracy from us."
During lengthy negotiations with police, the gunman said "the end is coming," Brown told reporters.
"He said he was upset about the recent police shootings," said Brown, who is black.
"The suspect said he was upset at white people. The suspect stated that he wanted to kill white people, especially white officers."
Authorities said that the gunman fired at least some of the shots in the attack but have not ruled out that other shooters were involved.
Details on how the shootings unfolded remained unclear.
It also was not clear how one person could have shot so many officers, though video of the attack taken by a witness shows a gunman carrying an assault-style weapon and carrying large amounts of ammunition.
The US Army said Johnson had served as a private first class in the Army Reserve, made up of part-time soldiers, and was deployed to Afghanistan from November 2013 to July 2014.
It said Johnson served from March 2009 to April 2015 and was a carpentry and masonry specialist with the 420th Engineering Brigade based in Texas.
In Poland for a NATO summit, President Barack Obama called the shooting "a vicious, calculated and despicable attack on law enforcement."
Obama, who has been stymied by the Republican-led Congress in his bid for new gun control laws, added, "We also know when people are armed with powerful weapons unfortunately it makes attacks like these more deadly and more tragic."
A string of killings of black men and boys by police in cities including Ferguson, Missouri, New York, Baltimore, Chicago, Cleveland, Tulsa, Oklahoma and North Charleston, South Carolina have given rise to the Black Lives Matter movement against excessive police force.
The killings have spurred almost two years of periodic and largely peaceful street protests.
Police believed during the shooting that they were under attack by multiple gunmen using high-powered rifles at ground level and on rooftops.
Police said they were questioning two occupants of a Mercedes they had pulled over after seeing a man throwing a camouflage bag inside the back of the vehicle, which then sped off on a downtown street.
A woman was also taken into custody near the garage where the standoff took place.
A Twitter account describing itself as representing the Black Lives Matter movement sent the message: "Black Lives Matter advocates dignity, justice and freedom. Not murder."
US Attorney General Loretta Lynch said the Justice Department would assist in the investigation into the shooting.
"Do not let this week precipitate a new normal in this country," Lynch told reporters in Washington.