Washington (CNN) President Barack Obama on Friday issued a thinly veiled rebuke of former House Speaker Newt Gingrich's call for the U.S. to test every person with a Muslim background to see if they believe in Sharia law and deport those who do.

Addressing the terror attack in Nice, France, that left more than 80 people dead, Obama didn't mention Gingrich by name, but there was little doubt who he was calling out.

"In the wake of last night's attacks, we've heard more suggestions that all Muslims in America be targeted, tested for their beliefs, some deported or jailed," Obama said in remarks from the White House. "And the very suggestion is repugnant and an affront to everything that we stand for as Americans."

Obama's implicit critique of Gingrich was a part of broader point he made Friday in response to the Nice attack, which he called "sickening."

"It's been a difficult several weeks in the United States, but the divide that exists is not between races and ethnicities and religions," Obama said. "And those impulses, when we do not speak out against them and build institutions to protect people from those impulses, they can take over. They can be unleashed, so all of us have responsibilities, not just a few."

Obama said the fight against terrorists will be won when the United States "stays true to our values."

Earlier Friday, White House Press Secretary Josh Earnest was asked directly about the former speaker's comments.

"It sounds like he may need to consult his copy of the pocket Constitution as well," Earnest said at a White House press briefing, adding that "proposals like that, rhetoric like that, is un-American by its very definition."

Gingrich's original comments came on Thursday night during an interview on Fox News, hours after a truck rampaged through a Bastille Day celebration in Nice.

"Let me be as blunt and direct as I can be: Western civilization is in a war. We should frankly test every person here who is of a Muslim background, and if they believe in Sharia, they should be deported," Gingrich said in an interview with Fox News' Sean Hannity. "Sharia is incompatible with Western civilization. Modern Muslims who have given up Sharia, glad to have them as citizens. Perfectly happy to have them next door."

Gingrich defended those comments Friday during an appearance on Facebook Live but acknowledged that "deportation is impossible" with American citizens.

"It's not appropriate under the Constitution, and historically, we've always said if you fought against the United States, that the correct answers were basically jail as opposed to deportation," he said. "I think we have to talk through what should be the right way of handling people who are here but are not citizens."

Newt Gingrinch speaks on February 27, 2015.

Gingrich also used the Facebook Live appearance to try to assuage Muslims living in the U.S.

"If you are a practicing Muslim and you believe deeply in your faith, but you're also loyal to the United States and you believe in the Constitution, you should have your rights totally, completely protected within the Constitution," Gingrich said. "You should have nothing to fear. Your children should have nothing to fear."

"This is not about targeting a particular religion or targeting people who practice in a particular way," he added. "This is about looking at particular characteristics that we have learned painfully, time after time, involve killing people, involve attacks on our civilization."

Muslims and experts on Islam quickly criticized Gingrich's initial comments.

Apparently a lot of ppl who know nothing abt Islam are now experts on Islam and sharia, telling Muslims what their religion *actually* says — Shadi Hamid (@shadihamid) July 15, 2016

"Apparently a lot of people who know nothing about Islam are now experts on Islam and sharia, telling Muslims what their religion actually says," tweeted Shadi Hamid, a senior fellow at the Brookings Institution.

While Sharia is often defined as "Islamic law," there is no single book of jurisprudence followed by all 1.6 billion Muslims. In fact, there are varying interpretations and legal opinions -- called fatwas -- most of which concern rituals, family matters and personal spirituality. In that way, Sharia is similar to Jewish law, and Israel is among the countries that allow Sharia courts, noted The Atlantic's Jeffrey Goldberg.

Omar Suleiman, a popular Muslim scholar in Dallas, took a defiant stance toward Gingrich's comments.

"Newt Gingrich, I'll make your job easier for you: I believe in every single tenet of my faith," Suleiman wrote in a Facebook post . "Because of that, I speak against extremists overseas and extremists like you and the fraud running for President. You can try to deport me now."

Gingrich calls for monitoring mosques

During the interview on Thursday, Hannity asked Gingrich how "you possibly ascertain whether or not that person really wants assimilation, really wants a new life, or whether or not they want to expand that caliphate, which is what we're at war against?"

"The first step is you have to ask them the questions," Gingrich responded. "The second step is you have to monitor what they're doing on the Internet. The third step is, let me be very clear, you have to monitor the mosques. I mean, if you're not prepared to monitor the mosques, this whole thing is a joke. Where do you think the primary source of recruitment is? Where do you think the primary place of indoctrination is? You've got to look at the madrassas -- if you're a school which is teaching Sharia, you want to expel it from the country."

The comments by Gingrich -- who was a finalist to be Donald Trump's running mate before the real estate mogul tapped Indiana Gov. Mike Pence on Thursday -- are similar to ones made by Trump himself last fall , when he called for surveillance of "certain mosques" to counter terrorist threats.

Gingrich also said Thursday that calling Islam a "religion of peace" is "bologna."

"It's not that Islamists are necessarily evil, but they're not necessarily a religion of peace," Gingrich said.

Gingrich then turned his focus to President Barack Obama, citing many leading Democrats' argument for stricter gun regulation laws after the Orlando terror attack , where 49 individuals where shot and killed inside a nightclub.

"I fully expect by tomorrow morning that President Obama will have rediscovered his left-wing roots and will give a press conference in which he'll explain that the problem is too many trucks," Gingrich said. "If only we had truck regulation, then we wouldn't have problems like Nice because it is trucks that are dangerous. I mean that's the exact analog to Orlando and just tells you how nuts the left wing in America is."

Trump's campaign manager Paul Manafort was asked to respond to Gingrich's comments on CNN's "New Day," but said he didn't know what Gingrich's comments were and what the context was.

"The point is the country's got serious problems dealing with terrorism," Manafort said.

Gingrich was also asked about Trump's decision to select Pence as his running mate. The former House speaker acknowledged it appeared the Indiana governor was the choice, but said, "I've not been officially told."