President Obama chastised Americans on Tuesday for forgetting their immigrant roots and neglecting the lessons of a checkered history in an address to 31 newly naturalized citizens, and he obliquely criticized Republican presidential candidates and others who have advocated immigration restrictions on Muslims seeking refuge in the United States.

“In the Syrian refugee today, we should see the Jewish refugee of World War II,” Obama said at the National Archives, surrounded by the original Constitution, the Bill of Rights and the Declaration of Independence. “How quickly we forget. How quickly we forget,” he said. “One generation passes, two generations pass, and we don’t remember where we came from and suggest that there is ‘us’ and there is ‘them’ — not remembering that we used to be ‘them.’ ”

Obama singled out the stories of three of the new citizens, highlighting one from Congo who had received political asylum and one from Iraq who had helped U.S. forces there.

The latter, Muhanned Ibrahim Al Naib, said in an interview that he worked for the Marines and then the Army, first as a translator and then as a computer expert for the police academy in Baghdad between 2003 and 2005. He also worked for a unit of Halliburton, then helped start two radio stations, he said.

He moved to Jordan in 2006 until receiving a U.S. visa in 2009, with a recommendation from now-retired Lt. Gen. Mark Hertling.

Engaged, Naib has just changed his name to Zachary Abraham O’Brien, taking the last name of his fiancee, whose family he said “took me in.”

“Today we stand by him and are proud to welcome him as a citizen of the country he already helped to defend,” Obama said.

“We cannot say it loudly or often enough: Immigrants revitalize a new America,” Obama said, ticking off details about the waves of newcomers arriving in the United States.

The comments came in a highly charged environment, just hours before the Republican presidential debate. Recent attacks in France and in San Bernardino, Calif., have heightened the intensity of the debate about how best to defend the country against terrorism.

Although noting that six of the signers of the Declaration of Independence were immigrants, Obama stressed in his comments that the United States has not always welcomed “wave after wave” of immigrants carrying “a family Bible, or Torah, or Koran.” But he said that “immigration is our origin story, and for more than two centuries it remains at the core of our national character.”

By attending the swearing-in ceremony in the Archives’ rotunda on the 224th anniversary of the ratification of the Bill of Rights, the president also highlighted the push he began in September to try to persuade the roughly 8.8 million eligible legal immigrants to apply for citizenship.

The potential that a wave of new citizens would vote overwhelmingly for Democrats is part of Obama’s motivation — and poses a threat to Republican candidates.

In 2012, Obama won 71 percent of the Hispanic vote, much of it from naturalized citizens. Recent Asian immigrants also skew Democratic in elections.

“This is an electorate incredibly sensitive to the signals being sent about how immigrants are going to be treated,” said Josh Hoyt, executive director of the National Partnership for New Americans. “We believe one of the antidotes to the climate of fear and hate is for them to build their voting power.”

An average of 654,000 people a year become naturalized citizens, but Hoyt hopes the number reaches 1 million next year. He said one obstacle is that applying for citizenship costs $680 and that 52 percent of legal permanent residents are working poor, earning less than $29,000 a year. If they fail the citizenship test, the money is lost.

Hoyt on Tuesday was in New York for a conference on immigration. Although all the presidential candidates from both parties were invited, only the Democrats showed up.

Hoyt said he received a polite note from Sen. Marco Rubio (R-Fla.) but did not hear back from most GOP candidates.

Obama has said that attending the naturalization ceremonies is among his favorite tasks. “We are a nation of immigrants — people from every corner, every walk of life, who picked up tools to help build our country, who started up businesses to advance our country, who took up arms to defend our country,” he said at the Korean War Memorial on April 25, 2014.

“If we want to keep attracting the best and the brightest, the smartest and the most selfless the world has to offer, then we have to keep this in mind: the value of our immigrants to our way of life,” he added then. “It is central to who we are. It’s in our DNA. It’s part of our creed.”

Immigrants who have held green cards for at least five years can apply for U.S. citizenship. But millions of legal immigrants do not do so.

U.S. District Judge Richard W. Roberts conducted the swearing-in Tuesday. As the names were called by the court clerk, each person stood and waved a small American flag.

The Archives holds naturalization ceremonies every year on the anniversary of the ratification of the Bill of Rights.

The new citizens are from 25 nations: Brazil, Bulgaria, Cameroon, Canada, Colombia, Congo, the Czech Republic, the Dominican Republic, El Salvador, Ethiopia, France, Gabon, Germany, Honduras, Hong Kong, Iraq, Ireland, Jamaica, Nepal, Peru, the Philippines, Romania, St. Lucia, Uganda and Venezuela.