Without mentioning Gingrich by name, Obama called his suggestion of a religious test "repugnant and an affront to everything we stand for as Americans."
"We cannot give in to fear or turn on each other or sacrifice our way of life," Obama said. "We cannot let ourselves be divided by religion, because that is exactly what the terrorists want."
The president was speaking at a reception for the diplomatic corps in Washington and met privately with the French ambassador to express his condolences and offer support prior to speaking publicly. In his public remarks, Obama called the attack tragic and sickening and vowed that the United States would continue to press its campaign against the Islamic State. He also expressed support for the family of Sean and Brodie Copeland, a Texas father and his 11-year-old son who were killed in Nice.
"They are grieving and need all the love and support of our American family as they grapple with an unimaginable loss and try to get through what are going to be very difficult days," Obama said.
"We will not relent. We are going to keep working together to prevent attacks and defend our homeland," he said. "We are going to destroy this vile terrorist organization."
There has been a string of terror attacks — some directed by the Islamic State and others merely inspired by the group — that have in recent weeks hit the United States, Turkey, Bangladesh, Iraq and Saudi Arabia. Obama described the individuals and networks that have carried out the attacks as "an affront to all of our humanity."
The president's remarks, though, were most striking for his concern about how some politicians in the United States and abroad were reacting to the bloodshed. Obama warned against those who seek to divide the world by tribe, ethnicity, faith or skin color.
"Those impulses exist in all our countries," he said. He urged diplomats to promote pluralism, the rule of law, and the freedom of religion, speech and assembly.
"On this planet of more than 7 billion people, the hatred and violence of a few ultimately is no match for the the love and decency and hard work of people of goodwill and compassion, so long as we stand up for those values," Obama said.
"We come here with heavier hearts than normal. Overnight in Nice, we witnessed another tragic and appalling attack on the freedom and peace that we cherish," he added. "Today our hearts are with the people of France and with all the innocent men, women and so many children who were hurt or killed in this sickening attack."