President Barack Obama says the shootings of five Dallas police officers would appear to have exposed the "the deepest fault line of our democracy" but that Americans must reject such despair.