US president Donald Trump sparked worldwide protests after signing an executive order that temporarily stops refugee admissions to the US for several months and blocks new visas for anyone from seven majority-Muslim countries: Iran, Iraq, Libya, Somalia, Sudan, Syria, and Yemen.

Critics were quick to point out that foreigners from the seven countries had killed zero Americans in terrorist attacks in the US between 1975 and the end of 2015. So why were they chosen for the ban?

Some have taken the selection as evidence of a conflict of interest, since it excludes Muslim-majority countries where the president has business ties. Former New York mayor Rudy Giuliani, who told Fox News that he assembled a commission at Trump’s request to come up with “the right way to do [a ban] legally,” said that it was “based on places where there are [sic] substantial evidence that people are sending terrorists into our country.”

But a look at the origins of the list of seven countries suggest the administration may have been simply looking for a way to lay the legal precedent for discrimination on Trump’s predecessor, Barack Obama.

The list of countries arose in a rare show of compromise between the White House and the Republican-led Congress in 2015, which resulted in the Visa Waiver Program Improvement and Terrorist Travel Prevention Act of 2015.

Thirty-eight countries participate in the Visa Waiver Program (VWP), which allows their citizens to visit the US for limited periods without applying for a visa in advance. Following the Nov. 13, 2015 attacks in Paris and the Dec. 2 shootings in San Bernardino, California, Republicans and White House officials cobbled together an overhaul of the VWP. Jamal Abdi, policy director of the National Iranian American Council, suggests Republicans had been goaded by Trump’s call for an outright ban on Muslims entering the US in the wake of the two attacks, and “forced Obama’s hand.”

The resulting legislation removed visa-free travel for citizens of VWP countries who had travelled to Iraq, Syria, Iran, or Sudan since 2011, or who also held citizenship of those countries. The countries were picked because they either had ”significant foreign terrorist organization presence” or were designated as state sponsors of terrorism.

The American Civil Liberties Union (ACLU) was quick to criticize the act, since it applied to all nationals of Iraq, Syria, Iran, or Sudan even if they had never been there. (For example, a child born to an Iranian father is an Iranian citizen, regardless of the child’s country of birth.) “Not only is this bill discriminatory, it is arbitrary,” the ACLU said.

The Obama administration would go on to announce further travel restrictions for the VWP. It added Libya, Somalia, and Yemen as “countries of concern” in February 2016—though citizens of those countries who had not traveled there could still participate in the VWP, unlike in the case of the initial four countries.

“The Visa Waiver Bill opened the door to normalize targeting people based on discrimination,” says Abdi warned at the time that the bill was a slippery slope. But even he couldn’t have guessed how slippery.

Trump has portrayed his policy as merely an extension of Obama’s, but that’s quite misleading, as Politifact notes. Obama’s law merely suspended visa-free travel for people who had been to one of the designated countries; Trump’s order blocks visas altogether for citizens of those countries.

Nonetheless, Abdi says, the Obama law “really normalizes this idea that you could be targeted based on your heritage.” Inadvertently, it paved the way for Trump’s policy. And hence, perhaps, the Trump administration’s apparently illogical decision to ban people from seven countries that have had no involvement in major attacks on US soil: It’s an attempt to entrench the precedent set by the Obama administration, while painting the Obama administration as its source. “It started with the VWP and we’re afraid of where this is going to end up,” Abdi says.