WASHINGTON — Governments of 12 countries whose citizens will be banned from visiting the United States beginning next week scrambled Thursday to understand President Donald Trump’s latest move to resurrect a hallmark policy of his first term.

The ban that Trump announced Wednesday takes effect at 12:01 a.m. Monday, a cushion that may avoid the chaos that unfolded at airports nationwide when a similar measure took effect with virtually no notice in 2017. Trump, who signaled plans for a ban upon taking office again in January, appears to be on firmer ground this time after the Supreme Court sided with him.

Some of the 12 countries also appeared on the list of banned countries in the Republican president’s first term. The new ban targets Afghanistan, Myanmar, Chad, the Republic of Congo, Equatorial Guinea, Eritrea, Haiti, Iran, Libya, Somalia, Sudan and Yemen.

There will also be heightened restrictions on visitors from seven other countries: Burundi, Cuba, Laos, Sierra Leone, Togo, Turkmenistan and Venezuela. North Korea and Syria, which were on the banned list in the first Trump administration, were spared this time.

While many of the listed countries send few people to the United States, Haiti, Cuba and Venezuela had been major sources of immigration in recent years.

Trump tied the new ban to Sunday’s terror attack in Boulder, Colorado, saying it underscored the dangers posed by some visitors who overstay visas. The suspect, who is accused of throwing Molotov cocktails at people, is from Egypt, which is not on Trump’s restricted list. The Department of Homeland Security says he overstayed a tourist visa.

The travel ban results from a Jan. 20 executive order Trump issued requiring government agencies to compile a report on “hostile attitudes” toward the U.S. and whether entry from certain countries is a national security risk.

Trump said some countries had “deficient” screening for passports and other public documents or have historically refused to take back their own citizens. He relied on an annual Homeland Security report of people who remain in the U.S. after their visas expired.

Measuring overstay rates has challenged experts for decades, but the government has made a limited attempt annually since 2016. Trump’s proclamation cites overstay rates for eight of the 12 banned countries.

While Trump’s list captures many of the most egregious offenders, it omits others. Djibouti, for example, had a 23.9% overstay rate among business visitors and tourists in the 12-month period through September 2023, higher than seven countries on the banned list and six countries on the restricted list.

The findings are “based on sketchy data and a misguided concept of collective punishment,” said Doug Rand, a former Biden immigration official.

The African Union Commission, meanwhile, appealed to the United States to reconsider “in a manner that is balanced, evidence-based, and reflective of the long-standing partnership between the United States and Africa.”

International aid groups and refugee resettlement organizations were harsher: “This latest proclamation is an attempt to further eviscerate lawful immigration pathways under the false guise of national security,” said Sarah Mehta, the American Civil Liberties Union’s deputy director of policy and government affairs for immigration.

Stephen Yale-Loehr, a retired Cornell University Law School professor and expert in immigration law, said the ban is likely to withstand legal challenges, noting the Supreme Court eventually allowed a ban to take effect in Trump’s first term. Trump’s invocation this week of national security, along with exceptions for green-card holders, athletes and others, could also help the ban stand up in court.

The Afghanistan travel ban was announced as avenues of support for Afghans who worked with the U.S. are being steadily eroded under the Trump administration. A refugee program has been suspended, and there is no funding to help them leave Afghanistan or resettle in the U.S., although a ban exception was made for people with special immigrant visas, a program created to help those in danger because they worked with the U.S. in the Afghan and Iraq wars.

Also, many people who “served shoulder-to-shoulder” with the U.S. did not qualify for the special visa program, according to No One Left Behind, a group advocating for Afghans who worked with the U.S.

Khalid Khan, an Afghan refugee now living in Pakistan, said he worked for the U.S. military for eight years.

“I feel abandoned,” Khan said. “So long as Trump is there, we are nowhere.”