DALLAS (AP) — President Barack Obama is asking Americans to find the character to open "our hearts to each other."

Obama spoke Tuesday at a memorial service for five officers killed in Dallas on Thursday. He is asking whether Americans can see in themselves a common humanity and recognize how different experiences have shaped people's perceptions.

Obama says, at times, he has doubts, saying "I've been to too many of these things."

He says that's why Americans should pray for each other to have not a heart of stone but one that's open to the fears and challenges of their fellow citizens.

Obama also says he believes the police officers who died in Dallas did not die in vain, and he says there is evil in the world, which is why "we need police departments."

Copyright 2016 The Associated Press. All rights reserved. This material may not be published, broadcast, rewritten or redistributed.