Visiting a mosque on U.S. soil for the first time, President Barack Obama urged Americans to reject politics that target those of a single faith and told Muslim-Americans “you’re right where you belong.”

Obama’s visit to the Islamic Society of Baltimore offered him a chance to counter anti-Muslim rhetoric from some leading GOP presidential hopefuls such as Donald Trump. And it was met with resistance from some on the country’s political right. Calling members of the Muslim faith who reside here “true Americans,” the president thanked them for “serving” their communities and helping “build America.”

Obama did not name Trump — who has called for a temporary ban on Muslims entering the U.S. — or any other Republican candidate. But he said “we have to understand an attack on one faith is an attack on all our faiths."

"None of us can be silent,” he said. “We can't be bystanders to bigotry."

Obama, who has been accused of secretly practicing the Islamic faith since before he was elected president, had a message for members of his own religion.

"To my fellow Christians: We have to understand an attack on one faith is an attack on all our faiths,” Obama said, also citing several founding fathers who helped write the Constitution.

The First Amendment begins “Congress shall make no law respecting an establishment of religion.” The president told an audience at the mosque that “our founders meant what they said.” He noted Thomas Jefferson was firm that those words “applied to all religions.” And he said Jefferson and John Adams owned copies of the Koran, the Islamic holy text.

Obama jabbed those who have accused him of being, as some have put it, a “secret Muslim.” He said Jefferson’s political foes tried to “stir things up” by accusing him of being a Muslim, something Obama said puts him “in good company.”

Obama took a rare shot at Hollywood, saying “our television shows should have some Muslim characters that are unrelated to homeland security — it’s not that hard to do.”

He also tried to dispel worries that many Muslim-Americans are extremists or linked to terrorist groups.

Violent extremist organizations like al-Qaeda and the Islamic State are part of a small percentage of the Muslim community that “draws selectively from Islamic texts,” he said. Those groups make “false claims that America and the West are at war with Islam.”

In the audience were the lone Muslims serving in Congress, Democratic Reps. Keith Ellison of Minnesota and Andre Carson of Indiana.

"President Obama's visit to the Islamic Society of Baltimore reminds us of one of our most important values — freedom of religion for everyone,” Ellison, the first Muslim member, said in a statement to Roll Call. “Our country was built by people of diverse backgrounds and religions. We are stronger when we stand up for everyone.

“Leaders are at their best when they call on us to strive for understanding and inclusion,” he added. “This is the leadership we should provide for our children and the world — today and every day.”

Despite the president’s upbeat message of unity and tolerance, the visit was controversial among some.

Mississippi Sen. Roger Wicker, chair of the National Republican Senatorial Committee, merely smiled widely Wednesday when asked by a reporter if Obama’s mosque visit might end up in GOP campaign ads this year.

In Baltimore, Obama’s motorcade was met by protesters outside the Islamic Center with signs urging him to avoid funding Hamas, and invoking Jesus and “sinners,” according to a pool reporter traveling with him.

Conservative media outlets ran stories accusing the center of terrorist ties, many noting it was named as an unindicted co-conspirator in a 2008 terrorism case. Fox News Channel’s morning show tweeted this Wednesday morning: “Baltimore mosque set for President Obama's historic visit today has controversial extremist ties.”

Missouri Sen. Roy Blunt, Republican conference vice chairman, said he had no concerns about Obama’s first U.S. mosque visit “as long as it was in the same spirit as when President [George W.] Bush went to a mosque after 9/11.”

“I believe reaching out to peaceful practitioners of the Muslim faith is a good thing for presidents to do,” Blunt said in an interview. “But I do think it’s really important that the president have a sense of the kinds of things happening at that mosque that he may be, in some way, tacitly endorsing.”

Former Florida Republican Rep. Allen B. West's website used a post earlier this week to draw a line from the Baltimore mosque and its former leader, Mohamad Adam el-Sheikh . Citing conservative media reports, the blog post accused el-Sheikh of ties to terrorist organizations: “What is that saying about the company you keep? Is there not a single U.S. mosque Obama could visit that doesn’t have any sort of extremist terror ties?”