After two full days of chaos and confusion, the Trump administration has reversed course on a major provision of its immigration order, announcing that permanent residents (green card holders) from seven majority-Muslim countries will in fact be allowed to enter the US.

The announcement came Sunday in a brief statement from Homeland Security Secretary John Kelly, who wrote, “In applying the provisions of the president’s executive order, I hereby deem the entry of lawful permanent residents to be in the national interest.”

Kelly continued: “Accordingly, absent the receipt of significant derogatory information indicating a serious threat to public safety and welfare, lawful permanent resident status will be a dispositive factor in our case-by-case determinations.” So while the statement still contains wiggle room to deny entry for some green card holders who Homeland Security agents get specific negative intelligence about, the assumption is that they will be allowed in.

Trump’s executive order, issued Friday, banned “aliens” who were nationals of seven majority-Muslim countries — Iran, Iraq, Syria, Libya, Somalia, Sudan, and Yemen — from entering the US for 90 days.

Though the order was spun as relating to refugees, analysts soon realized it used the term “aliens,” which encompasses all noncitizens — including lawful permanent residents who are foreign-born. There are up to 500,000 green-card holders from those seven countries, so the order meant that if they traveled abroad, they might not be let back in. And reports soon spread about some of them being denied entry into the US and not being allowed to board planes headed there.

On Saturday, a Department of Homeland Security spokesperson confirmed that the ban applied to green card holders too. It later emerged that this was the subject of internal dispute inside the administration — DHS had not wanted to apply the entry ban to green card holders, but White House aides Steve Bannon and Stephen Miller overruled them, according to a report by CNN’s Evan Perez and Pamela Brown.

While refugees are facing more imminent peril and fleeing more desperate situations, in its own way the green card move is immensely worrying too. Because here, Trump was not just preventing new people from coming — he was changing the rules for people who are already here legally. He was sending the message loud and clear that the United States is no longer a welcoming place for foreign-born people who have lived and worked here for years.

Even conservatives sympathetic with Trump’s refugee restrictions were flabbergasted that he applied them to green card holders, with David French of National Review calling it “madness.” And gradually, some Republican elected officials began to criticize this particular aspect of the order.

So on Sunday morning, White House Chief of Staff Reince Priebus telegraphed a walkback by appearing to say on television that the order would not apply to green card holders going forward. Still, most of the day passed without any concrete guidance from the government. Now, Secretary Kelly has finally offered some clarity.

Watch: Donald Trump's executive order, explained