The tech industry’s opposition to President Trump escalated Thursday as corporate leaders drafted a letter warning of the economic risks of his immigration policies, Uber’s chief executive quit an administration advisory board and Lyft pulled its ads from Breitbart News, the site formerly led by the White House chief strategist Stephen K. Bannon.

The developments followed remarks this week from Apple, Amazon and other companies, which said they were exploring legal action against Trump’s executive order that temporarily barred travelers from seven majority-Muslim countries. Amazon and Expedia also joined a lawsuit brought by the state of Washington against the immigration ban.

The actions underscored rising alarm along the West Coast’s tech archipelago from Silicon Valley to Seattle that Trump’s policies threaten a sector that has long been a driver of new wealth and innovation in an otherwise tepid economy. After attempting to reach out to Trump by attending a meeting at his hotel in New York, tech companies are preparing themselves for a high-stakes confrontation with the president.

Trump’s quest to tighten immigration has struck particularly hard at left-leaning Silicon Valley, which relies on a flow of high-level talent from India, east Asia and elsewhere and sees diversity as core to its identity as an innovation hub.

People shout slogans at the protest. (Kate Munsch/Reuters)

“People come to Silicon Valley so they can build the American Dream, and this is one of the last places where the American Dream still kind of works,” said Jonathan Nelson, chief executive of Hackers/Founders, a 300,000-person global network of entrepreneurs and engineers. “If this happens, you’re going to completely kill the next 10 years of tech companies.”

Some tech companies are now considering whether to move jobs out of the United States to places with more relaxed immigration policies, such as Vancouver, B.C., and Dublin, which have made clear they would welcome an influx of U.S.-based immigrant technology workers.

“One of the sad ironies of this is that an administration that purports to understand business is threatening one of the core pillars of what has made Silicon Valley so successful and an engine of economic growth,” said Matt Mahan, chief executive of the social networking start-up Brigade.

Tensions have been building since Friday night, when tech executives, including Apple’s Tim Cook and Google’s Sundar Pichai, began publicly denouncing the immigration ban. Protesters flooded U.S. airports and held rallies outside Google’s offices. In a flurry of emails and late-night phone calls among top executives, the industry began preparing a range of responses.

A little more than half of U.S. start-ups that are estimated to be worth more than $1 billion were founded by immigrants, according to the National Foundation for American Policy, an Arlington think tank. And Silicon Valley is littered with immigrant success stories: Satya Nadella, the chief executive of Microsoft, is an immigrant from India; Google co-founder Sergey Brin is a refugee from the former Soviet Union; and Omid Kordestani, Twitter’s executive chairman, was born in Iran.

Apple co-founder Steve Jobs was the son of a Syrian immigrant, leading Cook to say, in a letter denouncing Trump’s travel ban, that the company “wouldn’t exist” if such a ban had been in place.

Sam Altman, the president of Silicon Valley’s Y Combinator, called the reaction to the immigration ban a watershed moment in which the tech industry — rivals and all — made the unusual move of coming together and drawing a line in the sand against a sitting president.

(Jhaan Elker,Monica Akhtar/The Washington Post)

The steps taken by tech companies become more urgent after a draft of what appeared to be a Trump administration executive order limiting workers on H-1B visas circulated widely in Silicon Valley this week.

The leaked order indicated the administration could cancel the annual lottery through which technology companies sponsor tens of thousands of engineers, as well as a special visa for start-up founders who want to move to the United States.

A spokesman for the White House declined to comment on the leaked order or confirm its veracity. But White House press secretary Sean Spicer told reporters this week that the administration expects to scrutinize work visa programs closely as part of its immigration agenda.

“There’s an overall need to look at all of these programs,” said Spicer. “And you’ll see both through executive action and through comprehensive measures a way to address immigration as a whole and the visa program.”

As tensions built throughout the week, Uber chief executive Travis Kalanick and Tesla’s Elon Musk, who serve on Trump’s economic council, faced intense pressure to disavow their work with the administration, according to people familiar with the situation. Both have insisted, until now, that being at the table, and having the opportunity to influence the direction of the country, was better than not being at it.

But on Thursday, Kalanick said that he had spoken with Trump and told him that he would step down. Musk declined requests for comment.

Kalanick’s calculus changed after the company faced a huge outcry from the public for not joining Saturday’s protests at airports.

In his letter, Kalanick said he made his decision after hearing the stories of Uber employees and drivers, in particular those of Emil Michael, a refugee from Egypt, and Thuan Pham, a refugee from Vietnam.

Kalanick wrote that the executive order was hurting people across America and hurting Uber’s ability to make positive change in the country. “The implicit assumption that Uber (or I) was somehow endorsing the Administration’s agenda has created a perception-reality gap between who people think we are, and who we actually are,” he wrote. “There are many ways we will continue to advocate for just change on immigration but staying on the council was going to get in the way of that.”

In separate letter, more than 115 Silicon Valley start-up founders and venture capitalists pleaded with the administration to cancel the immigration ban.

“Silicon Valley flourishes because of our free and open culture of entrepreneurship and excellence,” they wrote. “The President’s actions yesterday not only negatively affect Tech’s competitiveness, they hurt the U.S. economy overall.”

Another letter from executives at Facebook, Google, Microsoft, Apple and others is also being drafted, according to a person familiar with the deliberations who spoke on the condition of anonymity to discuss the private matter.

In interviews, technology company officials said they were looking into relocating people to overseas offices in Ireland and other places in Europe. The officials spoke on the condition of anonymity because the deliberations were still underway.

“Tech companies are telling me they would rather set up subsidiaries or set up their companies in countries that are more welcoming and have friendlier immigration laws,” said Priya Alagiri, an immigration lawyer based in San Francisco who represents start-ups and tech firms. “They go to great lengths [to keep immigrant workers] because the workers are so highly talented and highly skilled.”

Meanwhile, Lyft, Uber’s ride-hailing rival, said Thursday that it was pulling ads from Breitbart News, following the actions of hundreds of other companies, including Lenovo, HP and T-Mobile. Many of the firms criticized the site as being an anti-immigrant and racist platform.

“One of Lyft’s core values is to uplift and support one another in all that we do,” said Adrian Durbin, Lyft’s director of communications. “We strive to ensure that our advertisements appear only on sites that share this value.”

Correction: A previous version of this story incorrectly stated that Stephen K. Bannon was the founder of Breitbart News. Bannon was a founding member of the board.

Timberg and Fung reported from Washington.