Snipers fired on police from buildings during a mass protest in Dallas against police killings of African-AmericansSmiley N. Pool/Associated Press

President Barack Obama has condemned the killing of five police officers in Dallas overnight by a gang of gunmen as a “vicious, calculated and despicable attack on law enforcement”.

Six other police officers were injured as at least four gunmen opened fire on protesters who were demonstrating against the killing of blacks by the authorities. This week, two black men in Louisiana and Minnesota were shot dead by policemen.

David Brown, head of police in Dallas, said that his officers had been ambushed by the snipers “working together with rifles, [from] elevated positions in different points in the downtown area”.