President Barack Obama on Thrusday came out in defense of the activist group Black Lives Matter, saying the group has "legitimate" concerns about the treatment of black people in jurisdictions and that it's unfair to portray them as anti-law enforcement.

He delivered his impassioned defense of the group during an event at the White House on criminal justice reform moderated by the Marshall Project, noting that the group is focusing on problems that only exist in black communities, according to the Huffington Post.

"We as a society, particularly given our history, have to take this seriously," Obama said of the fact that African-Americans are treated unfairly by the criminal justice system. "The African-American community is not just making this up, and it's not just something being politicized. It's real, and there's a history there."

He was quick to defend law enforcement, however, saying the "overwhelming majority of law enforcement is doing the right thing and wants to do the right thing," and that it's important to acknowledge that the criminal justice system is a reflection of our society, according to The Hill.

"We as a society, if we are not investing in opportunity for poor kids, and then we expect just the police and prosecutors to keep them out of sight and out of mind, that's a failed strategy. That's a failure on our part as a whole," Obama said. "If kids in the inner city are not getting treatment and opportunity, that's as much of a problem as if it's happening to our kids, and we've got to think of all our children in that same way."

Obama also addressed "All lives matter," the phrase many say to counter the movement's title and catchphrase. He argued that members of the Black Lives Matter movement were not suggesting black lives are more important than others but that certain events happen in black communities that would never happen in others, according to The Associated Press.

"I think everybody understands all lives matter," Obama said. Everybody wants strong and effective law enforcement, he said, and nobody wants to see police officers hurt who are doing their jobs fairly.

He concluded it wasn't fair to simply blame police, arguing that the country needs to do more to boost educational and economic opportunities in communities of color.

"If we as a society are willing to tolerate" disadvantaged communities, then express surprise about police tensions, "then we're passing the buck," Obama said.

"We have to make sure that all of us own it," he said.