Obama earlier on Friday called the shootings a "vicious, despicable and calculated" attack.
"Anyone involved in the senseless murders will be held fully accountable", the president added.
"When Trayvon Martin was first shot, I said that this could have been my son".
A Texas law enforcement official has told The Associated Press that a slain suspect in the attack on Dallas police was 25-year-old Micah Johnson.
Police say the gunman clearly stated his motive, but that's little comfort as the nation asks how this violence could have happened and what can be done to prevent similar acts.
House Minority Leader Nancy Pelosi took the floor after Ryan, joining in his expression of grief and thanking Dallas police officers for their service.
Snipers opened fire on police officers in the heart of Dallas Thursday evening, killing five officers and injuring six others during protests over two recent fatal police shootings of black men.
"We also know when people are armed with powerful weapons, unfortunately, it makes attacks like these more deadly and more tragic". "Today is a wrenching reminder of the sacrifices they make for us", he said.
Brown had said three officers were killed, and police issued a tweet later saying a fourth officer had died. In a hastily arranged statement to reporters, a visibly frustrated Obama urged Americans to do more to fight injustice and racial disparities in the criminal justice system.
The president, in his later remarks, denounced those who attacked police officers in Dallas while they were protecting demonstrators who were protesting against police actions. "Today our focus is on the victims and their families". "We don't feel much support most days".
Speaking in general about the fraternity of police officers, he went on to say: "They are heartbroken; the entire city of Dallas is grieving".
"To admit we've got a serious problem in no way contradicts our respect and appreciation for the vast majority of police officers who put their lives on the line to protect us every single day", Obama said. And they pleaded that we do more to stop the carnage. "As a nation, let's keep in mind to express our profound gratitude to our men and women in blue, not just today but every day".
Just one month after a grand jury's decision to not bring charges against the police officer involved in Michael Brown's death, a grand jury in NY also decided there was no probable cause that a crime was committed by NYPD officer Daniel Pantaleo in the death of Eric Garner.