Obama condemns anti-Muslim rhetoric in first US mosque visit
Barack Obama has condemned what he called "inexcusable political rhetoric" about Islam, an apparent reference to recent remarks by Republican presidential candidate Donald Trump.
In his first visit to a US mosque as president, Mr Obama said anti-Muslim rhetoric had "no place in our country".
He praised Muslim-Americans as "some of the most respectful and patriotic Americans you'll ever meet".
Mr Trump has called for Muslims to be banned from entering the US.
Mr Obama was speaking at the Islamic Society of Baltimore mosque in Maryland. He has visited mosques in other parts of the world on official trips abroad during his seven years as president.
The White House said the visit was intended as a defence of religious freedom and a statement against bigotry.
"The first thing I want to say is two words that Muslim-Americans don't hear often enough, and that is: thank you," Mr Obama said at the start of his speech.
"Thank you for serving your community, thank you for lifting up the lives of your neighbours, and for helping keep us strong and united as one American family."
The president said he recognised that Muslim-Americans were being "targeted and blamed for the acts of a few".
"Most Americans don't know of don't know they know a Muslim person," he said.
"Many only hear about Muslims and Islam from the news after an act of terror, or in a distorted media portrayal on TV or in a film.
Analysis: Barbara Plett Usher, BBC News Washington
Barack Hussein Obama has had a complicated relationship with Muslims. Early in his presidency he vowed to reshape relations with Muslims overseas after the disastrous fallout from the Iraq War.
That fizzled out in the tumult of the Arab revolutions. Back at home, he faced persistent allegations that he was a secret Muslim pretending to be a Christian, fuelled by his name and his Muslim relatives.
That came to a head with a satirical 2008 New Yorker cover depicting Mr Obama and his wife as terrorists - the presidential candidate in traditional Islamic clothes. Mr Obama has dismissed rumours about his Muslim faith as silliness. He's focused instead on refusing to link Islam with terrorism, for which he is praised by American-Muslims and excoriated by Republicans campaigning for his job.
It's not clear if any of this history prompted him to delay visiting a mosque until his last year in office: American presidents rarely pay formal visits to houses of worship and he waited until last May to attend a synagogue in his presidential capacity.
Advocacy group Council on American-Islamic Relations (CAIR) says it has tracked a growing number of attacks on mosques and Muslims since the Paris and San Bernardino attacks.
A report by the group warned that "levels of anti-Muslim sentiment follow trends in domestic US politics", highlighting Mr Trump's call for a ban on Muslims entering the country.
Ibrahim Hooper from CAIR said: "I don't think there's ever been this level of fear and apprehension in the Muslim-American community.
"For some time, we've been asking for pushback. Perhaps this will start a trend."
Mr Obama is in his final year as president. A week ago, he became the first sitting president to speak at the Israeli embassy, where he warned of growing anti-Semitism.
Akbar Ahmed, an Islamic studies specialist at American University, said Mr Obama had left it "literally to the last" to visit a US mosque, but he added: "Better late than never."
In 2010 the White House blamed a "misinformation campaign" for a growing belief that Mr Obama was a Muslim. Over the course of his presidency, some people have said he is a Muslim pretending to be a Christian.