U.S. President Donald Trump signs executive orders in the Hall of Heroes at the Department of Defense on January 27, 2017 in Arlington, Virginia Olivier Douliery-Pool/Getty Images The White House may compel US customs officials and border patrol agents to ask foreign visitors to provide their social media and cell phone contacts upon entering the US, White House policy director Stephen Miller said on Saturday.

The move would fall under Trump's executive order temporarily barring refugees and visa holders from six Muslim-majority countries —Iraq, Iran, Sudan, Libya, Somalia and Yemen — from entering the US, according to CNN.

Syrians have been banned indefinitely.

The idea of checking foreigners' social media posts, which remains limited to a preliminary discussion, draws on a supposed history of terror attacks where the attacker had previously expressed extremist views on platforms like Facebook and Twitter.

Some have pointed to the San Bernardino terror attack as evidence that such a policy might be useful: An FBI document produced shortly after the shooting said that the woman who helped carry it out pledged allegiance to ISIS while the attack was ongoing. FBI director James Comey later confirmed, however, that the attackers — Syed Rizwan Farook, 28, and Tashfeen Malik, 29 — expressed support for "jihad and martyrdom" in private communications but never did so publicly on social media.

It is unclear whether the social media mandate would be constitutional. Legal challenges have already been presented to Trump's "extreme vetting" order, and large protests erupted at airports across the country on Saturday as news emerged that people from the banned countries, who had valid visas and green cards, were being detained — and, in some cases, deported — by customs officials and border patrol agents.

Lawyers representing two Iraqi refugees who were detained at John F. Kennedy airport in New York filed legal challenges to Trump's executive order, and a federal judge in Brooklyn issued an emergency rulingSaturday evening to prevent the continued deportation of travelers.

The ruling, a temporary emergency stay, now allows those who landed in the US and hold a valid visa to remain. Federal judges in Virginia, Massachusetts, and Washington also made emergency rulings on various aspects of the executive order.

Natasha Bertrand contributed reporting.