Dallas - President Barack Obama attended a sombre memorial on Tuesday to five police officers slain in a sniper ambush in Dallas, as he seeks to unify a country divided by race and politics.Accompanied by First Lady Michelle Obama, the president left Washington with the depressingly familiar task of ministering to a country stunned by gun violence.The mayor of Dallas opened the service, saying the "soul of our city was pierced".In the days since the shooting that rocked America - carried out by a black gunman intent on killing whites in retribution for police brutality - Mike Rawlings said the city's residents "have sobbed and paid tribute"."Today we open our city's doors" he said, thanking Obama for attending the memorial service.But the most poignant tribute was to "peacemakers in blue" Brent Thompson, Patrick Zamarripa, Michael Krol, Lorne Ahrens and Michael Smith.Each officer was represented by an empty chair in the auditorium, each adorned with a folded US flag and officer's cap.Obama spent much of Monday preparing his address to the interfaith service, also attended by his predecessor, Republican former president George W Bush.His address comes as a monumental test of leadership as tenure in the White House comes to an end.Back to the 1960s? Eight years ago, Obama's rhetorical prowess made him America's first black president and raised hopes that the country could overcome deeply entrenched societal divides.Today, Obama insists those divisions are not as great as shootings, social networks or the media would have you believe. "I firmly believe that America is not as divided as some have suggested," Obama said on a European trip cut short because of the Dallas shooting.This is not, he argued, the dark days of the 1960s, when American cities burned and assassins' bullets killed President John F Kennedy and Martin Luther King jnr. "The president recognises that it's not just people in Dallas who are grieving - it's people all across the country who are concerned about the violence that so many Americans have witnessed in the last week or so," White House spokesperson Josh Earnest said on Monday."The president is hoping to offer some measure of comfort tomorrow."The challenge for Obama is not to be seen as offering a professorial answer - through yet another intricately crafted speech - to people's visceral concerns.From Charleston to Orlando to Dallas, the past year has seen a torrent of slaughter motivated by hate.The massacres have brought a measure of common revulsion, but not a common purpose.Republicans in Congress steadfastly oppose even piecemeal gun controls.Each week seemingly brings new shaky footage of a police officer shooting dead a black American - images that quickly go viral and revive tough questions about race and policing.America, black and blue Last week, the fatal police shootings of two black men, Alton Sterling in Louisiana and Philando Castile in Minnesota, prompted nationwide anger, with thousands of protesters taking to the streets from coast to coast.They also seemingly triggered the deadly rampage in Dallas by black Afghanistan war veteran Micah Johnson, as a protest against police brutality was wrapping up.Johnson, 25, used a high-powered rifle to kill five police officers and wound nine others in a sniper attack late on Thursday. Two civilians were also hurt.He told negotiators before he was killed that he wanted to murder white cops in revenge for the black deaths.Obama has struggled most to tether the twin spectres of race and guns that have been raised by the Dallas shooting."There is no contradiction between us supporting law enforcement... and also saying that there are problems across our criminal justice system, there are biases - some conscious and unconscious - that have to be rooted out," Obama said."So when people say 'black lives matter', that doesn't mean blue lives don't matter; it just means all lives matter."In Dallas, a black trauma surgeon Brian Williams, who treated several police officers, gave poignant voice to the fissures that have shaken the country.He spoke of buying ice cream for a cops so that his young daughter could see him interacting normally with the police - and not grow up with the same fears he has.Addressing police, he said: "I support you, I will defend you and I will care for you." "That doesn't mean that I do not fear you."