By Joseph Menn and Kristina Cooke

SAN FRANCISCO (Reuters) - The U.S. technology industry, a major employer of foreign workers, hit back on Saturday at President Donald Trump's sudden executive order on immigration, with some leaders calling it immoral and un-American.

Trump's order temporarily bars citizens of seven majority-Muslim countries from entering the United States even if they hold valid visas or permanent residence permits, a move that caught many companies off-guard.

Netflix Inc Chief Executive Reed Hastings called it "a sad week" and added: "It is time to link arms together to protect American values of freedom and opportunity."

Apple Inc CEO Tim Cook sent a letter to employees saying Trump's order was "not a policy we support" and promised to help affected employees.

"We have reached out to the White House to explain the negative effect on our coworkers and our company," Cook added.

Aaron Levie, the outspoken founder and CEO of online storage company Box Inc, said: "The executive order on immigration is immoral and antithetical to our values."

STRANDED

Friday's order could be a major headache for tech companies, potentially leaving employees stranded overseas and unable to return to the United States.

Alphabet Inc's Google urgently called back employees from overseas and told ones who might be affected by the ban not to leave the United States.

CEO Sundar Pichai said in an email to staff that more than 100 Google employees were affected by the order, according to a Google executive.

One Google employee of Iranian nationality with legal U.S. residency made it back to the United States just hours before the order took effect, the executive said.

"We're concerned about the impact of this order and any proposals that could impose restrictions on Googlers and their families, or that could create barriers to bringing great talent to the U.S.," Google said in a statement.

Microsoft Corp President and Chief Legal Officer Brad Smith said in a company-wide email posted on LinkedIn that 76 company employees were citizens of the seven countries in question and held U.S. work visas, and thus were directly affected by the order.

He said the company had not determined how many people with green cards, or permanent residence status, might be affected.

Related:

For more news videos visit Yahoo View, available now on iOS and Android.

"As a company, Microsoft believes in a strong and balanced high-skilled immigration system," Smith said in the email. "We also believe in broader immigration opportunities, like the protections for talented and law-abiding young people under the Deferred Access for Childhood Arrivals (DACA) Program, often called "Dreamers."

Smith also said: "We believe in the importance of protecting legitimate and law-abiding refugees whose very lives may be at stake in immigration proceedings."

Uber Technologies Inc [UBER.UL] CEO Travis Kalanick, who has faced criticism from some employees for participating in President Trump's business advisory council, said in a statement on Saturday that the company would compensate drivers from the seven countries who might not be able to return to the United States for three months or more. He said the company knew of about a dozen employees who would be affected.

"This ban will impact many innocent people - an issue that I will raise this coming Friday when I go to Washington for President Trump’s first business advisory group meeting," Kalanick said.

Facebook Inc CEO Mark Zuckerberg said in a post on Friday that was "concerned" about the order and voiced support for immigrants.

(Reporting by Joseph Menn, Kristina Cook and Julia Love; Writing by Jonathan Weber; Editing by Alan Crosby and Bill Rigby)