Republican presidential candidate Marco Rubio seized the opportunity to criticize President Barack Obama's speech condemning Islamophobia during his historic trip to an American mosque on Wednesday.

During his speech, the president denounced the growth of anti-Islamic rhetoric in the country, which is primarily being recited by Republican leaders and 2016 candidates like Donald Trump.

"An attack on one faith is an attack on all our faiths," Obama said at The Islamic Society of Baltimore, which marked his first visit to a mosque in the U.S. "We have to be consistent in condemning hateful rhetoric. ... None of us can be bystanders to bigotry."

The president also thanked attendees in the packed auditorium for standing up against terrorism, adding that religious extremists have given a "hugely distorted impression" of their faith.

At another part of the speech, he assured American Muslims that they are a crucial part of America's fabric and future.

"Let me say as clearly as I can as president of the United States: You fit right here," he said. "You're right where you belong. You're part of America too. You're not Muslim or American. You're Muslim and American."

In response, Rubio slammed the president's speech on religious tolerance and unity, calling it divisive and claiming that it is a distraction from the real problem plaguing America: radical Islam.

"I'm tired of being divided against each other for political reasons like this president's done," the Florida senator said during a campaign stop in Dover, New Hampshire, on Wednesday.

"Always pitting people against each other," he said pointing to Obama's speech as an example. "He gave a speech at a mosque. Oh, you know, basically implying that America is discriminating against Muslims."

According to Rubio, Obama's focus on intolerance is distracting Americans from fighting religious extremism and terrorism.

"Of course there's discrimination in America, of every kind. But the bigger issue is radical Islam. And by the way, radical Islam poses a threat to Muslims themselves," he said.

Listen to Rubio's attack on the president's speech below: