WASHINGTON — President Trump on Friday closed the nation’s borders to refugees from around the world, ordering that families fleeing the slaughter in Syria be indefinitely blocked from entering the United States, and temporarily suspending immigration from several predominantly Muslim countries.

In an executive order that he said was part of an extreme vetting plan to keep out “radical Islamic terrorists,” Mr. Trump also established a religious test for refugees from Muslim nations: He ordered that Christians and others from minority religions be granted priority over Muslims.

“We don’t want them here,” Mr. Trump said of Islamist terrorists during a signing ceremony at the Pentagon. “We want to ensure that we are not admitting into our country the very threats our soldiers are fighting overseas. We only want to admit those into our country who will support our country, and love deeply our people.”

Earlier in the day, Mr. Trump explained to an interviewer for the Christian Broadcasting Network that Christians in Syria were “horribly treated” and alleged that under previous administrations, “if you were a Muslim you could come in, but if you were a Christian, it was almost impossible.”