President Obama on Tuesday used the interfaith memorial service for five Dallas police officers killed by a sniper to promote gun control, arguing it's easier for a teen to get a weapon than a book.

"We've chosen to underinvest in decent schools," he said. "We allow poverty to fester, so that entire neighborhoods offer no possibility of gainful employment. We've refused to fund mental health programs. We flood communities with so many guns it's easier for a teen to get his hands on a Glock than get a computer or a book."

Obama, who has pressed more for gun control than any other president in recent history, continued, "Then we tell police you're the social worker, you're the parent, you're the teacher, you're the drug counselor."

The service at Morton H. Meyerson Symphony Center in Dallas was in honor of Dallas Police Sgt. Michael Smith, 55; Dallas Police Senior Cpl. Lorne Ahrens; Dallas Police Officer Michael Krol; Dallas Police Officer Patrick Zamarripa; and Dallas Area Rapid Transit Officer Brent Thompson.

TRENDING: Undercover journalist turns the tables, sues Planned Parenthood for defamation

They were killed last Thursday at a protest against the killing by police of a black man in Minnesota and one in Louisiana.

"Even though many dislike the phrase Black Lives Matter, surely we should be able to hear the pain of Alton Sterling's family … Philando Castile, his life mattered to a whole lot of people," Obama said, referring to the two black men.

Published by WND Books, Jack Cashill’s “‘If I Had a Son’: Race, Guns, and the Railroading of George Zimmerman” examines the facts and exposes the bias of the news media in the racially charged case.

The Dallas officers were protecting the protesters when Micah Johnson started shooting. During the firefight with police, Johnson said he wanted to kill white people.

Five officers died, and seven more were injured. Johnson was killed when police fashioned a bomb and had a robot deliver it to a point in the parking garage where Johnson was cornered to kill him.

Thousands of dignitaries, officers and others gathered for the memorial. It was not open to the public.

Obama said communities have been torn apart and hearts broken by violence, and many wonder if the division ever can be resolved.

"The African-American community feels unfairly targeted … and police feel unfairly maligned for doing their jobs."

He continued: "We also know that centuries of racial discrimination, of slavery, and subjugation and Jim Crow, they didn't simply vanish with the end of lawful segregation. They didn't just stop when Dr. King made a speech, or when the voting rights and civil rights act were signed.

"We know, Americans know that bias remains. We know it. Whether you are black or white or Asian, or native American or Middle Eastern descent. We have all seen this bigotry at some point. We have heard it in our own homes. If we're honest perhaps we've heard prejudice in our own heads, and felt it in our own hearts."

Some Americans, he pointed out, have suffered far more from racism than others.

But he said American should reject such despair, and he praised the Dallas police officers because "when the bullets started flying ... they did not flinch and they did not react recklessly."

Former President George W. Bush, a Dallas resident, praised the officers while mourning "five deaths in the family."

"Their courage is our protection and shield," he said. "We are grief-stricken, heart broken and forever grateful."

Several ministers offered prayers, and Sen. John Cornyn, R-Texas, said he once was told, "Being a Texan doesn't describe where you're from, it describes who your family is."

Dallas Police Chief David Brown quoted recording artist Stevie Wonder:

The Fox affiliate in Dallas reported Obama called family members of Sterling and Castile while en route to the Dallas memorial service.

White House spokesman Josh Earnest said Obama offered condolences.

Published by WND Books, Jack Cashill’s “‘If I Had a Son’: Race, Guns, and the Railroading of George Zimmerman” examines the facts and exposes the bias of the news media in the racially charged case.

Just one day earlier, Breitbart reported, Obama had told a gathering of law enforcement officials, "I'm your best hope," for reaching reconciliation with the black community.

According to a police official quoted by the Washington Post, the gathering was just ahead of Obama's trip to Dallas for the memorial.

Said the report, "Obama's experience as the nation's first black president has apparently convinced him that he is the only one who can solve the problem."

The report continued, "Obama's involvement in police relations with the black community dates to his years in Chicago and the Illinois state senate, where he had few legislative achievements but was credited for a legislative effort to reform police interrogations."