A Dallas police officer, who survived the sniper shooting in which five of his colleagues were killed, has recalled the moment he was shot as he attempted to load wounded people into patrol cars.

Officer Jorge Barrientos, 28, who was shot in the hand and hit in the chest with shrapnel, described crawling for cover as shots rang out in downtown Dallas around 9pm on 7 June.

"He knew what he was doing," Barrientos told Associated Press of gunman Micah Johnson, 25, who began shooting at police following a Black Lives Matter demonstration against police brutality following the fatal shootings of Philando Castile and Alton Sterling.

"He knew where he was firing from. He ambushed us in a manner that he didn't want us to see where he was."

Johnson, who was a member of the military and had undertaken active duty in Afghanistan, is believed to have been acting alone and allegedly told police he "wanted to kill white people, especially white officers."

Five police officers, including three from Barrientos' unit, were shot dead and 12 others injured, including two civilians, in an attack that ended after Johnson was killed by a police remote-controlled robot.

During the shooting, Barrientos and other officers attempted to load their injured colleagues into police patrol cars to get them to hospital quickly, but Barrientos was shot in the hand while carrying out the task, bandaging himself up before continuing to help other officers.

"You don't have time to concentrate on being scared," he told AP. "I have a job to do. They're part of my job at that point. To save them."