U.S. President Barack Obama delivers remarks at the Islamic Society of Baltimore mosque in Catonsville, Maryland, Feb. 3, 2016. REUTERS/Jonathan Ernst

President Barack Obama visited a mosque in the United States for the first time during his presidency on Wednesday, delivering a stirring address that condemned hateful rhetoric against Muslims and called on Americans of all faiths to stamp out bigotry.

Speaking at the 47-year-old Islamic Society of Baltimore in Maryland, Obama recognized the rise in anti-Muslim sentiment and violence in the U.S., fueled in part by the heated political rhetoric employed by politicians during the 2016 presidential campaign.

"Recently, we’ve heard inexcusable political rhetoric against Muslim Americans that has no place in our country,” said Obama, taking a thinly veiled jab at Republican presidential candidate Donald Trump, who has called for a temporary ban on all Muslims from entering the country.

"We’ve seen children bullied, we’ve seen mosques vandalized," he continued. "It’s not who we are. We're one American family. And when any part of our family begins to feel separate or second class, it tears at the heart of our nation."

The president continued by celebrating the achievements and contributions of Muslim Americans and highlighting the history of Islam and Muslims in the United States.

“Islam has always been a part of America,” said Obama. “Muslim Americans are some of the most resilient and patriotic Americans you’ll ever meet."

During his discussion of the history of Islam in the United States, the president employed some humor in addressing the rumors about his faith that have dogged him since before his presidency.

“Thomas Jefferson's opponents tried to stir things up by suggesting he was a Muslim. So I was not the first," Obama said, to audience laughter. "No, it's true. Look it up. I'm in good company."

RTX25BB6 (1)
U.S. President Barack Obama goes without shoes, out of deference, as he delivers remarks at the Islamic Society of Baltimore mosque in Catonsville, Maryland, Feb. 3, 2016. REUTERS/Jonathan Ernst

The president also acknowledged that a small fraction of Muslims do commit violent acts of terror in the name of their religion, but added that he would not legitimize groups like ISIS and al Qaeda by accepting them as Muslims.

"Groups like ISIL are desperate for legitimacy," said Obama. "We must never give them that legitimacy."

Obama’s visit comes at time when anti-Muslim sentiment is on the rise. There has been a documented increase in hate crimes against Muslims in the U.S. since the Paris and San Bernardino attacks, while politicians have fiercely debated U.S. policy to accept Syrian refugees, who are mostly Muslim. A recent study from the Center for the Study of Hate and Extremism at California State University in San Bernardino found that hate crimes against Muslims tripled since the two attacks, reaching levels not seen since the immediate aftermath of Sept. 11, 2001.

Muslims aren’t the only faith audience the president is addressing. Last week, he spoke about the Holocaust at the Israeli embassy in Washington, proudly declaring that “I, too, am a Jew” in an act of Christian-Jewish solidarity. On Thursday, the president will address the National Prayer Breakfast, whose attendees are mostly Christian — although members of other faiths do attend.

While President Obama has visited several mosques abroad during his presidency, this was the first time he ever spoke in one at home. Before the address on Wednesday afternoon, the president held a closed-door roundtable with 12 Muslim-American leaders including activists, students and scholars.

Muslim Americans and interfaith activists welcomed Obama’s speech, though some critics argued that his gesture comes too late.

“I do think it should have happened a long time ago,” Haroon Moghul, a fellow at the Institute for Social Policy and Understanding, told the Guardian. “I don’t know why he has not visited a mosque before. If I’m being charitable, I would say it may just not have been a priority. Another reason is the optics may have caused him some grief, but that’s precisely why he should have gone in view of the current climate.”