U.S. President Barack Obama sought Saturday to reassure Americans shaken up by what he acknowledged was a "painful week" following two fatal police shootings of African-Americans and an ambush that left five policemen dead in Dallas.
Obama was speaking at a NATO summit in Warsaw, but he devoted much of his news conference to events back home. The president is cutting his trip to Europe short by one day and will return to Washington Sunday night. He said he planned to travel to Dallas in the coming days at the invitation of Mayor Mike Rawlings.
The city remained on edge Saturday, especially after Dallas police received an anonymous threat against officers across the city. The threat led officials to lock down the headquarters and several blocks surrounding the building as a "precautionary measure," a police statement said.
In Poland, Obama opened his remarks with the aftermath of the Dallas shooting, saying, "I firmly believe America is not as divided as some have suggested." He said the country has a foundation to build on to tackle the very real problems it faces, including tensions between law enforcement and minority communities.
Asked about how he would characterize the Dallas shooter, Obama called him a "demented individual."
WATCH: Dallas Honors Fallen Officers
The Dallas shooter is not representative of blacks, the president said, just as the man who killed people at a historic African-American church last year in Charleston is not representative of whites, and the Muslim American who killed 49 people at an Orlando nightclub last month is not representative of Muslim Americans.
'Part of the problem'
On the issue of gun violence, in response to a question, Obama said, "I am not going to stop talking about guns, because they are part of the problem."
He said if people care about the safety of police officers, they cannot pretend that the gun issue is irrelevant. He said it would never be possible to stop every violent madman intent on carnage, but the U.S. could make it much harder for them.
He said the scope of gun violence in the United States is unique.
On Saturday, the people of Dallas were working through the emotions of Thursday's violence and trying to make sense of the tragedy, which in addition to the fatalities it caused left seven officers and two civilians injured.
In front of Dallas Police Department headquarters, passers-by offered condolences at two squad cars decked with flowers, children’s toys and notes of sympathy.
Those who came were African-Americans, whites and Latinos, and included many officers mourning the loss of their colleagues.
Michael Walton, a Dallas police officer and president of the Dallas Fraternal Order of Police, earlier in the day had visited the injured officers in the hospital.
“They’re going to be OK one day,” Walton said. “We’re just trying to get them through it, support them, let them know that we’re still here for them, and their families, too.”
Recalling the events of Thursday night, “I was ... just in shock,” recalled Terry Mack, an officer with the Dallas transit police, who was off duty but lost one colleague and saw others injured. He said he had worked with them all.
“All of our officers are heroes,” said Dallas police Sergeant Demetrick Pennie, president of the Dallas Fallen Officers Foundation. “While everyone else was running away from the bullets, our officers were running to the bullets."
Karen Copeland came to the memorial site with her daughter Kylie, 5, to try to make sense of images they had seen on television, and “to show her [daughter] that in the midst of it all, there’s still peace and people still have love in their hearts.”
Jason Quigley, a sheriff’s department deputy in nearby Denton County, brought his teenage daughter to “understand what we do every day and understand what can happen to us.”
Quigley said he also wanted her to see “how the community supports everybody.”
More than a dozen riders from the Southern Dawgs Motorcycle Club, which includes former police officers, also came to pay their respects.
“The people that were there that night were peaceful, exercising their right to voice their opinion,” said the club’s spokesman, known as Shocker. He said the man who attacked the officers was cowardly.
WATCH: 'I Firmly Believe America is Not as Divided as Some Have Suggested,' Obama Says
Obama spoke at length on race relations, rejecting any suggestion that the country was returning to the strife and urban riots of the 1960s, and noting that police in Dallas kept on protecting protesters even while they were being shot at.
He said the country has made tremendous progress, both in lowering violent crime rates and on achieving racial equality. But, the president added, the legacy of racism endures, and there is much work still to be done.
Obama said that he hoped his daughters, Sasha and Malia, and their children could live in a more just and equal country, but that progress takes time.
Asked about his legacy on race as the first African-American president, Obama said: "We plant seeds. And somebody else maybe sits under the shade of the tree that we planted."
The president left Warsaw after the news conference for Spain, arriving Saturday night. Obama will meet with King Felipe and acting Prime Minister Mariano Rajoy before traveling to a U.S. naval base in Rota, in southern Spain.
From aboard Air Force One on the flight to Madrid, Obama phoned Texas Governor Greg Abbott to offer his condolences on behalf of the American people, a White House statement said.
Details of attack
Dallas Mayor Rawlings confirmed that the shooting of the officers on Thursday was carried out by a lone gunman, identified as Micah Johnson. The attack, which city officials labeled an "ambush," happened toward the end of a peaceful demonstration against the killing of two black men by police officers in Minnesota and Louisiana earlier in the week.
Texas Governor Abbott said law enforcement officers would investigate and determine whether any co-conspirators or other suspects might have helped him. He added, "We need to focus on the imperative of unity: that we unite all citizens of Dallas, all citizens of Texas."
During a search of Johnson's home Friday, Dallas police detectives found bomb-making materials, ballistic vests, rifles, ammunition and a personal journal of combat tactics, the police department said. The gunman was a former Army reservist who served in Afghanistan.
The attack was the deadliest day for U.S. law enforcement since the terror attacks of September 11, 2001, on the U.S. East Coast.