Many travelers were detained in airports after President Trump signed an executive order that prohibited people from seven Muslim-majority countries from entering the U.S. The order caused widespread chaos and confusion at airports as protesters crowded terminals and agencies struggled to interpret the new rules.

Caught in the middle were the airlines, which were not only dealing with passengers denied entry, but with their employees who might violate the travel ban, too.

"We actually did have some flight attendants who were detained in the process, flight attendants who can legally fly in and out of the country today for U.S. airlines or who are based in the U.S.," says Sara Nelson, president of the Association of Flight Attendants.

"These flight attendants, we have to remember that they are subject to background checks, they are subject to a security clearance that is required for them to do this work," she says.

Not only must airlines enforce stringent post-Sept. 11 screening for their employees, but flight crew members who aren't U.S. citizens already need a special visa to enter the U.S.

Now, airlines are scrambling to juggle staffing to assure no flight crew members working U.S.-bound flights are from the seven countries singled out in the executive order.

"I think the order really came out of something as a surprise, both in its breadth and its speed to the airline community," says independent airline industry consultant John Strickland.

"Airlines are by their nature global businesses," he says. "They employ people from many countries and passport origins."

Strickland says the executive order is especially difficult for airlines based in the Middle East, in places like the United Arab Emirates and Qatar. Those companies now have to quickly check the birthplaces and backgrounds of all their crew members, to make sure that those from Iran, Iraq, Libya, Somalia, Sudan, Syria and Yemen are not working on flights headed to the U.S.

"When you're talking about a long-haul airline with crews in different parts of the world and aircraft in different parts of the world, that's really somewhat like jelly trying to get your hands on it," he says.

Airlines had no advance notice of the president's action, says Jason Sinclair, spokesman for the International Air Transport Association.

"The executive order was issued without prior coordination or warning, causing confusion among both airlines and travelers," he says. "It also placed additional burdens on airlines to comply with unclear requirements, to bear implementation costs, and to face potential penalties for noncompliance."

Those costs include airfare refunds to customers who are told they cannot board, or who cancel because of the chaos.

Airlines want clarity from the administration, and Secretary of Homeland Security John Kelly tried to provide some on the new travel restrictions in a news conference Tuesday.

Kelly denied reports that even he wasn't given details of the executive order until the president signed it, and said it will remain in place.

"We cannot gamble with American lives," he said. "I will not gamble with American lives."

Copyright 2017 NPR. To see more, visit http://www.npr.org/.