Updated

President Obama on Wednesday made his first presidential visit to a U.S. mosque, using it to condemn bias toward Muslim-Americans that he argued is fueled by the media and “inexcusable political rhetoric.”

“That has no place here,” Obama said at the Islamic Society of Baltimore. “We are one American family. … An attack on one faith is an attack on all faiths.”

Still, the visit was overshadowed by Obama’s choice of mosque, whose former imam, Mohamad Adam El-Sheikh, has ties with the Muslim Brotherhood and the northern Virginia mosque where radical Anwar al-Awlaki used to preach.

“As a Muslim American, I’m just insulted. This is disgraceful that this is one of the mosques -- or the mosque -- that he’s chosen to visit,” Zuhdi Jasser, of the American Islamic Forum for Democracy, told Fox News on Sunday.

The president did not touch on the criticism on Wednesday, as he spoke broadly about tolerance. In Obama’s roughly 40-minute speech, he quoted from the Koran, the Islamic religious text, which he said was on President Thomas Jefferson’s bookshelf.

And he used the Muslim greeting, “As-salamu alaykum,” which translates from Arabic to “Peace be upon you.”

Muslim-Americans said they had been waiting for such a visit from  America's political and religious leaders.

"For some time, we've been asking for pushback. Perhaps this will start a trend," said Ibrahim Hooper, a spokesman for the Council on American-Islamic Relations.

CAIR has tracked a growing number of attacks on mosques and on individuals in the months following the Paris terrorist attack and the shooting rampage in San Bernardino, California.

A severed pig's head was delivered to a mosque's doorstep in Philadelphia. Someone attempted to set fire to a mosque in Southern California. Fourteen people were killed in the San Bernardino attack, carried out in December by a Muslim-American male and his wife, a recent Muslim immigrant who had been “radicalized.”

Hooper also cited Republican presidential candidate Donald Trump's call for a temporary ban on Muslims entering the country as an example of bias.

Obama didn’t single out anybody specifically in his speech. But he said, “We cannot give into profiling single groups of people.”

He also said the portrayal of Muslim-Americans is being “distorted” by the media in TV and film.

The president frequently mentioned young Muslim-Americans, saying he chatted with several of them before he spoke in Baltimore and made clear his speech was inspired by their words and letters.

“A girl from Ohio, 20-years-old, told me, ‘I’m scared,’ ” Obama said. “These are children like mine. That’s not who we are.”

Obama has been sharply criticized in the past for referring to the Islamic State as a “J.V. team” and not describing their members as Islamic terrorists.

On Wednesday, he said, “I refuse to give them legitimacy.”

The president also acknowledged the uneasy relationship between Muslim-Americans and U.S. law enforcement officials.

“Law enforcement has a tough job,” said Obama, acknowledging that the relationship between the sides will continue to be bumpy. ”This is something we have to do together. If we don’t do it well, we’re not making ourselves safe.”

For years, Obama has fought unrelenting and incorrect claims that he's actually a Muslim and was born in Kenya, beliefs that polls suggest remain prevalent among many Republicans to this day. Obama, a Christian, was born in Hawaii.

Nearly half of Americans think at least some U.S. Muslims are anti-American, according to a new Pew Research Center poll released Wednesday. Two-thirds of Americans said people, not religious teachings, are to blame when violence is committed in the name of faith. However, when respondents were asked which religion they consider troubling, Islam was the most common answer.

The Associated Press contributed to this report.