Obama condemns police shooting amid US racial tensions

Snipers on rooftops gunned down five officers and wounded six more in a co-ordinated attack.

FILE: US President Barack Obama. Picture: AFP.

JOHANNESBURG - United States President Barack Obama has sent his condolences to the families of five police officers who were gunned down in Dallas.

Snipers operating from rooftops gunned down the officers and wounded six more in a co-ordinated attack during one of several protests across the country against the killing of two black men by police this week.

Alton Sterling was killed outside a shop in Louisiana on Tuesday, while Philando Castile was shot during a traffic stop in Minnesota just a day later.

Police have described the sniper attack as carefully planned and Obama has labelled it vicious, calculated and despicable.

"I believe that I speak for every single American when I say that we are horrified over these events, and that we stand united with the people and the police department of Dallas."

WATCH: US officers shot and killed in Dallas protest

The attack ended when police used a bomb to kill a shooter who told them he wanted to kill white officers, authorities said Friday.

Police said they had taken three people into custody before killing the fourth after a long standoff in a downtown garage.

"We had an exchange of gunfire with the suspect. We saw no other option but to use our bomb robot," Dallas Police Chief David Brown told reporters at City Hall.

"The suspect said he was upset about Black Lives Matter," said Brown, who is black. "He said he was upset about the recent police shootings. The suspect said he was upset at white people. The suspect stated that he wanted to kill white people, especially white officers."

A total of 12 police officers and two civilians were shot during the attack, Dallas Mayor Mike Rawlings said. Three of the officers who were shot were women, he said.

Rawlings told CBS News the people in custody, including one woman, were "not being cooperative" with police investigators. He said the assailant who was dead was being fingerprinted and his identity checked with federal authorities.

Police were still not certain they knew all of the individuals involved in the attack, Rawlings said.

There was no sign of international links to the attacks, US officials said on Friday.

Obama says the Federal Bureau of Investigation is already in touch with Dallas police to assist with the investigation.

POLICE BRUTALITY: US vs SA

Andrew Fall from the centre of criminology at the University of Cape Town says there are lessons for South Africans to learn from this shooting.

"We have police killing people 12 times faster than in America. I think this is a very big problem here. We definitely shouldn't be pointing fingers at the US. We've got plenty of fish to sort out back home."