Micah Xavier Johnson, accused of shooting dead five US police officers in Dallas before himself being killed by police, was a US army veteran who had served in Afghanistan.
The 25-year-old was a private who did a nine-month tour of duty from November 2013 after serving in the Army Reserve for six years, the US military said.
Six months into his tour of Afghanistan a female soldier accused him of sexual harassment and Johnson was later sent home, a military lawyer who represented him said.
Johnson acted alone in the Dallas attack and had no known criminal history or ties to terrorist groups, authorities said.
He lived with his mother in the quiet Dallas suburb of Mesquite.
The BBC's Laura Bicker in Mesquite says the area is characterised by nice houses and well-kept gardens and neighbours say they are shocked that someone from there could kill police officers.
His sister wrote of her shock on Facebook, saying: "I keep saying it's not true … My eyes hurt from crying," in a post that she later deleted.
"The news will say what they think, but those that knew him know this wasn't like him. This is the biggest loss we've had," she wrote later.
Johnson belonged to an informal gun club and took frequent target practice, the Los Angeles Times newspaper reported, quoting an unnamed law enforcement source.
His military occupational specialty was carpentry and masonry, the army said, and he had been awarded medals including the Afghanistan Campaign Medal with campaign star, an Army Achievement Medal, an Army Service Ribbon and an Armed Forces Reserve Medal with "M" Device, among other standard awards for service.
But lawyer Bradford Glendening said Johnson was sent home after the sexual harassment accusation, with the army recommending an "other than honourable discharge".
Johnson was ordered to avoid all contact with the accuser.
Mr Glendening said Johnson was to have been removed from the army in September 2014 but for unknown reasons was instead given an honourable discharge in April 2015.
Johnson's Facebook profile photograph showed him giving a raised fist "black power" salute associated with the Black Panther Party movement, a radical political organisation that emerged during the 1960s in response to police brutality in California.
The Black Panthers carried out armed citizens' patrols to monitor police behaviour.
Johnson had joined Facebook groups that referenced the Black Panther Party, the LA Times reported, including one called the Huey P. Newton Gun Club, named after one of the Black Panthers' founders.
The group was created in Dallas last year to oppose police brutality, teaches self-defence and conducts patrols in areas where black men have been killed by the police.
However, one of the group's members told the newspaper they did not know Johnson and had nothing to do with him.
Johnson's Facebook profile also had photographs of the Pan-African or Black Liberation flag made up of red black and green stripes, an image depicting a black power salute and a photograph of him with Professor Griff, a former member of the US rap group Public Enemy.
Johnson was killed when police used explosives placed by a robot to end a tense stand-off in a building where he was holed up.