The suspect in the deadly attack on Dallas police taunted authorities during two hours of negotiations, laughing at them, singing and at one point asking how many officers he had shot, the city's police chief has revealed.

Micah Johnson, a black Army veteran, insisted on speaking with a black negotiator and wrote in blood on the wall of a parking garage where police cornered and later killed him, David Brown told CNN's State Of The Union.

Johnson, who was apparently injured in a shoot-out with police, wrote the letters "RB" and other markings. Investigators are now trying to decipher the writing by looking through evidence from his suburban Dallas home, Mr Brown said.

The chief defended the decision to kill Johnson with a bomb delivered by remote-controlled robot, saying negotiations went nowhere and officers could not approach him without putting themselves in danger.

Mr Brown said he became increasingly concerned that "at a split second, he would charge us and take out many more before we would kill him".

Johnson had practised military-style drills in his garden and trained at a private self-defence school that teaches special tactics, including "shooting on the move".

On Friday, Dallas Mayor Mike Rawlings described Johnson as "a mobile shooter" who had written manifestos on how to "shoot and move".

Authorities have said the gunman kept a journal of combat tactics and had amassed a personal arsenal at his home, including bomb-making materials, rifles and ammunition.

Johnson donned a protective vest and used a military-style semi-automatic rifle for the shootings, which marked the deadliest day for US law enforcement since 9/11.

In all, 12 officers were shot, five fatally, just a few blocks from where President John F Kennedy was assassinated in 1963.

Johnson was a private first class with a speciality in carpentry and masonry. He served in the Army Reserve for six years starting in 2009 and did one tour in Afghanistan from November 2013 to July 2014, the military said.

The attack began on Thursday evening while hundreds of people were gathered to protest against the police killings of Philando Castile, who was shot near St Paul, Minnesota, and Alton Sterling, who was shot in Louisiana after being pinned to the pavement by two white officers.

Video showed protesters marching along a street about half-a-mile from City Hall when shots erupted and the crowd scattered, seeking cover.

Marcus Carter was in the area when people started running towards him, yelling about gunshots. He said the first shot sounded like a firecracker. But then they proceeded in quick succession, with brief pauses between spurts of gunfire.

"It was breaks in the fire," he said. "It was a single shot and then after that single shot, it was a brief pause," followed by many shots in quick succession.

Sign up to our free newsletters

Get the best updates straight to your inbox:
Please select at least one mailing list.

You can unsubscribe at any time by clicking the link in the footer of our emails. We use Mailchimp as our marketing platform. By subscribing, you acknowledge that your information will be transferred to Mailchimp for processing.