DALLAS --At a memorial for slain police officers, President Barack Obama declared Tuesday that a week of deeply troubling violence has appeared to expose "the deepest fault lines of our democracy." But he insisted the nation is not as divided as it seems and called on Americans to search for common ground in support of racial equity and justice.
Obama acknowledged Americans are unsettled by another mass shooting on their streets and are seeking answers to the violence that has sparked protests in cities and highlighted the nation's persistent racial divide.
Five Dallas officers were killed last Thursday while standing guard as hundreds of people protested the police killings of black men in Louisiana and Minnesota earlier in the week.
"It's hard not to think sometimes that the center might not hold, that things might get worse," Obama said. "We must reject such despair."
He joined politicians, police officers and families of the fallen in the wake of the shocking slaying by a black man who said he wanted revenge for the killings of blacks by police.
"The soul of our city was pierced," Dallas Mayor Mike Rawlings said, as he welcomed Obama to a memorial service. The group had assembled because to combat "a common disease" of violence and honor those who fight it, "our men and women in blue, our peacemakers in blue."
Rawlings spoke steps from five empty chairs and five portraits of the dead officers.
A call for national and solidarity was reinforced by several speakers at the interfaith service, including former President George W. Bush, a Dallas resident, who attended with his wife, Laura.
"At times it feels like the forces pulling us apart are stronger than the forces binding us together," Bush said. "Too often we judge other groups by their worst examples, while judging ourselves by our best intentions. And this has strained our bonds of understanding and common purpose."
Bush called on Americans to reject the unity of grief and fear.
"We want the unity of hope, affection and higher purpose," he said.
Obama has denounced the shooting as a "vicious, calculated and despicable attack on law enforcement" by a "demented" individual. And he has argued that, despite the heated public outcry of the past week, the country is not as divided as it may seem.
WATCH: FULL VIDEO OF OBAMA'S REMARKS
Obama's choice of traveling companions underscored the theme. Republican Sen. Ted Cruz of Texas and House Democratic Leader Nancy Pelosi of California joined Obama on Air Force One for the flight to Dallas. Republican Sen. John Cornyn, attended and spoke at the service but did not travel with the president.
He described the attack as deeply personal.
"Being a Texan doesn't describe where you're from it, describe who your family is," the senator said.
The White House said president worked late into the night writing his speech and consulting scripture for inspiration.
Just a few weeks ago, Obama spent hours in Orlando, Florida, consoling the loved ones of 49 people who were killed in a shooting rampage at a nightclub.
The Dallas attack ended with the gunman, Micah Johnson, 25, blown up by a bomb delivered by a police robot. The black Army veteran portrayed his attack on the officers as payback for the fatal police shootings of black men in Baton Rouge, Louisiana, and suburban Minneapolis.
Portions of both shootings were videotaped and broadcast nationwide, leading to fresh outrage, protests and scores of arrests. The killings also put the country on edge, heightened racial tensions and pushed the issue of the use of deadly force against black males by white police to the forefront.
Obama sought to begin bridging those issues with his tribute to the fallen five, who included a former Army Ranger, a Navy veteran and a newlywed starting a second family.
Some police officials blame the president for the rise in racial tension, saying he is insufficiently supportive of law enforcement. In comments since the Dallas shooting, Obama has urged the public to recognize and respect that police officers have a tough job.
Meanwhile, he has been criticized by others for going to Dallas before visiting Louisiana or Minnesota.
As Obama landed in Dallas, spokesman Josh Earnest said the president had telephone the families of Alton Sterling, the man shot by police in Baton Rouge, and Philando Castile, the Minnesota motorist shot by an officer, to offer his and the first lady's condolences.
The president, joined by his wife, Michelle, and Vice President Joe Biden and his wife, Jill, were also meeting privately in Dallas with families of the slain officers. At least nine other officers and two civilians were injured in the attack.