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 and pushed back against those who demonize all Muslims for the acts of a few extremists.

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 in the past, 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 a growing number of attacks on mosques and on individuals following 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. Denouncing a political dynamic that incentivizes attacks against certain religions, he said it fell on all Americans to speak up.

For Obama, the visit in his final year in office reflects a willingness to wade into touchy social issues that often eluded him earlier in his presidency. For years, Obama has fought incorrect claims that he’s actually a Muslim and was born in Kenya, beliefs that polls suggest remain prevalent among many Republicans. Obama, a Christian, was born in Hawaii.

Obama, acknowledging that uncomfortable chapter in his own story, noted that Thomas Jefferson had also been accused of being a Muslim.

"So I was not the first," Obama said to laughter from a hundred or so Muslims who gathered for his speech. "No, it’s true. Look it up."

He also drew a parallel between Muslim-Americans’ struggle for broad societal acceptance and that of African-Americans, noting that "there was a time when there were no black people on television."

With no plans to ever again appear on a ballot, Obama faces less pressure to avoid political controversy, and seemed to relish the possibility that his visit would raise eyebrows among some of his most entrenched critics. Ahead of his visit, White House officials readily acknowledged the visit could spark controversy but suggested that would help make his point about ignorance and religious bias.

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

Join our Newsletter for the latest news right to your inbox