CATONSVILLE, Md. (AP) -- President Barack Obama sought Wednesday to correct what he called a "hugely distorted impression" of Muslim-Americans as he made his first visit to a U.S. mosque. He said those who demonize all Muslims for the acts of a few are playing into extremists' hands.

Inserting himself into a debate that has ricocheted in the presidential campaign, Obama told parishioners at a mosque outside Baltimore that he'd heard from young Muslims worried they'll be rounded up and kicked out of the country. He said Muslims, too, are concerned about the threat of terrorism but are too often blamed as a group "for the violent acts of the very few."

"We've seen children bullied, we've seen mosques vandalized," Obama said, warning that such unequal treatment for certain groups in society tears at the nation's fabric. "That's not who we are."

For Muslim advocates, Obama's visit was a long-awaited gesture to a community that has warned of escalating vitriol against them that has accompanied the public's concern about the Islamic State and other extremist groups. Although Obama has visited mosques overseas, he waited until his final year in office to make such a visit at home, reflecting the issue's sensitive political implications.

In this year's Republican presidential campaign, Donald Trump has called for banning Muslims from the U.S. temporarily and Ted Cruz and Marco Rubio warned of "radical Islamic terrorism." Muslim-American advocacy groups have warned of growing antagonism that has followed recent attacks in Paris and San Bernardino, California, by those purporting to act in the name of Islam.

"We have to understand: An attack on one faith is an attack on all our faiths," Obama said. He said it fell on all Americans to speak up.