The Dallas police chief said early Friday three suspects are in custody and authorities say a fourth suspect is dead hours after a peaceful demonstration to protest the slayings elsewhere of two black men by white police officers erupted into chaos. Five of the 11 police officers shot during the chaos in Dallas have died.

Police had been negotiating with the fourth gunman who exchanged gunfire with police in a standoff at a downtown garage. It is not clear if the gunman shot himself or was killed by police.

U.S. President Barack Obama said Friday the shootings were a "vicious, calculated and despicable attack" on officers who were performing their jobs. Speaking in Warsaw where he is attending a NATO summit, Obama said police have "an extraordinarily difficult job" and the shootings are "a wretched reminder" of the hazards police face.

Emergency responders administer CPR to an unknown patient on a stretcher as law enforcement officials stand nearby at the emergency receiving area of Baylor University Medical Center, early Friday, July 8, 2016.

Police Chief David Brown said one of the detained suspects is a female. The other two suspects being interviewed, Brown said, were seen with camouflage bags, prompting officers to follow their car.

Brown said the suspects have not given any indication about why they launched their attack on the officers.

The police chief said he did not have a "complete comfort level" that all the suspects have been detained.

A Dallas policeman keeps watch on a street in downtown Dallas, Thursday, July 7, 2016.

Officials say the attackers had intended widespread damage and a suspicious package has been secured by the city's bomb squad.

Dallas Mayor Mike Rawlings has asked people who work in the downtown area where the shootings occurred to stay away Friday.

Police had issued a photograph of an armed black man in camouflage dress who attended the demonstration as "a person of interest" in Thursday's shooting. The man later turned himself into authorities, who say he was apparently not involved in the shootings.

Dallas police detain a driver after several police officers were shot in downtown Dallas, Thursday, July 7, 2016.

Police say two snipers opened fire on police during the demonstration that was being held late Thursday to protest the police killings of two black men earlier this week in separate incidents - one in Minnesota, the other in Louisiana.

The two killings of the black men are the latest incidents in a string of shootings in the U.S. of what is widely viewed as examples of the excessive use of force in police dealings with minorities.