President Trump's decision to ban transgender people from the military is putting him at odds with technology companies and could create tensions even as his administration continues working to make inroads with Silicon Valley.

The president took military leaders, lawmakers, and the public by surprise Wednesday morning when he sent three tweets reversing an Obama-era policy allowing transgender individuals in the military to serve openly.

"After consultation with my Generals and military experts, please be advised that the United States Government will not accept or allow Transgender individuals to serve in any capacity in the U.S. Military," the president said. "Our military must be focused on decisive and overwhelming victory and cannot be burdened with the tremendous medical costs and disruption that transgender in the military would entail."

Immediately after the announcement, congressional Democrats and Republicans said they opposed the policy change, and Trump's tweets were said to catch top officials at the Pentagon by surprise. But the policy also put him in conflict with the tech community, which the Trump administration is trying to woo.

Hours after Trump's three tweets were published, leaders of the largest tech companies began to protest the president's transgender ban, with many using the hashtag #LetThemServe to voice their support for transgender people.

"I am grateful to the transgender members of the military #LetThemServe," Google CEO Sundar Pichai tweeted.

"Discrimination of any form is wrong for all of us #LetThemServe," Jack Dorsey, co-founder and CEO of Twitter, said on his account.

Apple CEO Tim Cook went so far as to accuse the president of discriminating against transgender people.

"We are indebted to all who serve. Discrimination against everyone holds everyone back #LetThemServe," he tweeted.

On Facebook, leaders at the social media company expressed their disagreement with Trump's transgender ban.

"Everyone should be able to serve their country – no matter who they are," Mark Zuckerberg, Facebook's founder and CEO, wrote on his personal page.

Sheryl Sandberg, Facebook's chief operating officer, echoed Zuckerberg's comments.

"As Mark said, we should be grateful for everyone, including those in the transgender community, willing to serve our country. #LetThemServe," she wrote on her personal Facebook page.

Trump's announcement, and the backlash that followed, comes as his daughter and assistant to the president, Ivanka Trump, attempts to rally tech leaders.

Ivanka Trump and Reed Cordish, the assistant to the president for intergovernmental and technology initiatives, launched an outreach campaign to business leaders this week and are asking for help on approaches to STEM education in the public school system.

The two participated in a conference call Wednesday with tech CEOs including Microsoft President Brad Smith and Apple's Cook, as well as educators and elected officials, according to Bloomberg.

In addition to working on STEM education, the White House is looking to Silicon Valley to assist in its efforts to make government more effective.

The Trump administration has sought input from tech companies on how to modernize the government's technology systems and protect from cyberattacks, and the president met with executives from leading technology companies to discuss those issues last month as part of the inaugural gathering of the American Technology Council.

So far, the tech industry has been on the opposite side of the Trump administration on issues beyond Trump's transgender ban.

Just before the American Technology Council's summit, the president decided to withdraw the U.S. from the Paris Agreement, a decision that earned him shark rebuke from the tech community — including from some CEOs who met with the president at the White House last month.

Trump's announcement on the Paris climate accord caused at least two CEOs, Elon Musk of Tesla and SpaceX, and Bob Iger of Disney, to leave their positions on the White House's advisory boards.

The disagreements between the tech community and Trump aren't likely to end there, as companies have already come out strongly against his travel ban.