The twin forces of immigration and migration have become increasingly vexing problems for the United States and much of the world.

Those tensions were sketched in sharp relief this week across the metropolitan area, where law enforcement officials are working to learn more about the suspect in the Chelsea and New Jersey bombings, a naturalized citizen born in Afghanistan; at the United Nations, where President Barack Obama yesterday warned world leaders not to succumb to the belief that people who look different corrupt the character of the countries that welcome them; and on the presidential campaign trail, where contenders have used these events to bolster their candidacies.

It’s been an extraordinary clash of real-life problems and philosophical ideals. And it has made clear that our nation must stay true to the ideals on which it was founded.

That doesn’t mean we should reject outright Republican presidential nominee Donald Trump’s contention that immigration security is national security. It is part of national security, and the long, stringent refugee vetting process has a good track record, but our security apparatus surely can be improved.

The father of Chelsea suspect Ahmad Khan Rahami, for example, apparently alerted law enforcement authorities two years ago about his concerns regarding his son, but the FBI cleared Rahami. Rahami also passed federal screening on return trips from Afghanistan and Pakistan. Separately, an audit by the Department of Homeland Security found that immigration officials mistakenly granted citizenship to 858 immigrants with pending deportation orders; they used different names or dates of birth in applying for citizenship, discrepancies not caught because their fingerprints were not in electronic databases.

The answer is to strengthen our processes, not resort to profiling and bans based on religion. We also must condemn Donald Trump Jr.’s comparison of Syrian refugees to a bowl of Skittles, three of which “would kill you” — a detestable attempt to equate Syrians fleeing death and destruction in their homeland with candy that might be poisoned.

advertisement | advertise on newsday

Obama got it right when he pleaded for empathy for such people. He asked all of us to imagine the “unspeakable” happening to our families. The world, he noted, is more secure when we all help those in need.

People have every right to be nervous in these tenuous times, but that must not paralyze us. Obama was correct to decry populism that preys on fear and that longs for a simpler past “free from outside contamination.” In a swipe at candidate Trump, Obama said that such a nation which surrounds itself with walls would end up imprisoning itself.

More than 190 nations this week signed a declaration to accept more refugees, if they can, and to contribute more humanitarian aid, if possible. That’s weak and not binding. And it does nothing to address the conflicts that have displaced more than 65 million people, conflicts sometimes made worse by the actions of powerful outsiders like the United States.

Refugees, Obama said, can make us stronger. They have already. That bit of real life is powerful support for one of our ideals, the one that says we are a nation that welcomes those in need of a home. We might need to get better at doing that, but we must make sure our doors stay open. — The editorial board