The legal battle between Twitter and the US government ended Friday, after the Department of Homeland Security withdrew its demand that the tech company release information to identify an account holder whose tweets are critical of President Donald Trump.

The lawsuit threatened to become a major battle over free speech between Silicon Valley and Washington. But it was over almost before it began. The tech company had filed a lawsuit Thursday to protest the order, saying that it violated the user's First Amendment right to free expression. But Twitter dropped its suit Friday, saying in a court filing that "[because] the summons has now been withdrawn, Twitter voluntary dismisses without prejudice all claims."

The DHS did not immediately respond to a request for comment.

Twitter filed the suit to protect the identity of a user who runs the @ALT_uscis feed -- an account that purports to tweet the thoughts of a federal worker from the U.S. Citizenship and Immigration Services. The two-month-old account is often critical of the Trump administration's immigration policies, particularly its plans to build a wall along the border with Mexico and its immigration travel ban.

Legal experts said that Twitter would have had a strong case had it gone to court, as the government had not provided compelling information on why it was necessary to identify the critic.

The government, in order to enforce its subpoena, would have had to demonstrate that whoever is behind the Twitter account was likely violating some law. There also were serious questions about whether the type of subpoena used, which is typically for investigating violations of export rules, was appropriate for the type of case DHS was probing, experts said.

Weekly high-tech hot topics in the blogs: Windows 7, iMacs, Twitter search results Show all 2 1 /2 Weekly high-tech hot topics in the blogs: Windows 7, iMacs, Twitter search results Weekly high-tech hot topics in the blogs: Windows 7, iMacs, Twitter search results All Rights Reserved Weekly high-tech hot topics in the blogs: Windows 7, iMacs, Twitter search results Apple

Courts also have traditionally given a high degree or protection to political speech, including the right to speak anonymously or with a pseudonym. That includes, in many circumstances, government employees who are critical of the agencies for which they work.

"This is just, as best as I can tell, the government trying to figure out who is expressing criticisms, and that is chilling," said Marc Rotenberg, executive director of the Electronic Privacy Information Center.

If the goal was to quiet the dissent, it seems to have failed. The number of followers for the Twitter account grew from "over 32,000" to more than 150,000 in less than 24 hours.

Sen. Ron Wyden, D-Ore., on Thursday called the government's attempt to unmask the identity of the Twitter user a "witch hunt." On Friday, Wyden sent a letter to DHS's Customs and Border Protection agency, which demanded the information, asking them to investigate "why and how" the order came about.

"Not only was the summons blatantly inconsistent with the cited investigatory authority, section 509 of the Tariff Act of 1930, but it appeared to be a disturbing threat to free speech and whistleblower protections," Wyden's letter said.

A lawyer at the American Civil Liberties Union, which represented the user, said in a statement Friday that the speed with which the government withdrew the request shows how problematic its demand was.

"Speaking anonymously about issues of the day is a longstanding American tradition, dating back to when the framers of the Constitution wrote under pseudonyms," said Esha Bhandari, one of the lawyers. "The anonymity that the First Amendment guarantees is often most essential when people criticise the government, and this free speech right is as important today as ever."

Twitter has fought battles with the government before over user privacy. In 2012, the social network appealed an order from the state of New York to reveal personal user data from the account of Occupy Wall Street protester Malcolm Harris. It lost that appeal. The company also sued the Justice Department in 2014 for the right to make federal information requests for user data public.

Twitter's actions this week highlight how much responsibility social media platforms hold in today's debates about the right to free expression in the modern world, experts said. While social media networks may give a voice to millions of individuals, it is the companies' opinions, clout and resources that actually speak volumes.

"People love to speak about a global town square, but it's hosted on company servers and not government servers. That means that the rights and terms and conditions that are granted are very much determined by a small group of people," said Alex Howard, deputy director at the Sunlight Foundation, a nonprofit that focuses on technology and open government. "The choices they make to stand up for their users set important precedents for other companies now and into the future."

The person behind @ALT_uscis did not respond to a request for comment sent over Twitter. But the user did thank Twitter and the ACLU, tweeting: