The lawsuit over the account @ALT_uscis, claimed to be run by at least one federal immigration employee, was filed in federal court in San Francisco, where Twitter is based. The acronym CIS refers to US Citizenship and Immigration Services, and the account's description refers to itself as "immigration resistance."
Following Trump's inauguration in January, anonymous Twitter feeds voicing concerns at more than a dozen US government agencies appeared to challenge the president's views on climate change and other issues. Trump has vowed to build a wall along the US border with Mexico and has promised to deport millions of illegal immigrants.
"The rights of free speech afforded Twitter's users and Twitter itself under the First Amendment of the US Constitution include a right to disseminate such anonymous or pseudonymous political speech," Twitter said in the lawsuit.
The US Department of Homeland Security, which is a defendant in the lawsuit, declined to comment on pending litigation. The Justice Department, which typically represents federal agencies in court, also declined to comment.
Esha Bhandari, a staff attorney with the American Civil Liberties Union, which is representing the Twitter user in the case, said the government's request was highly unusual. Requests for social media account information from the US government typically involve a pressing national security or criminal matter, she said.
"We have seen no reason the government has given for seeking to unmask this speaker's identity," Bhandari said, adding that the right to anonymous speech against the government is "a bedrock American value" strongly protected under the First Amendment of the US Constitution.
Shortly after the lawsuit became public, @ALT_uscis tweeted a copy of the First Amendment and a picture of part of the lawsuit to its 45,000 followers, an increase of about 12,000 in a few hours.
Twitter said it received an administrative summons last month demanding that it provide records related to the account.
It was not immediately clear how the anonymous account fit into those laws and regulations.
The social media company has a history of challenging other government demands for information on its users, including a 2012 demand from New York prosecutors about an Occupy Wall Street protester. In that case, Twitter was forced to hand over tweets from the protester to a judge, and the protester pleaded guilty to disorderly conduct.
Twitter sued the US Department of Justice in 2014, seeking permission to publicly disclose more information about requests it gets from US authorities for information about its users. The lawsuit was partly dismissed last year.
Among the lawyers representing Twitter in the latest case is Seth Waxman, a former high-ranking Justice Department official under President Bill Clinton.
(Reporting by David Ingram; Additional reporting by Dustin Volz and David Shepardson in Washington and Melissa Fares in New York; Editing by Lisa Shumaker)
Get Breaking news, live coverage, and Latest News from India and around the world on NDTV.com. Catch all the Live TV action on NDTV 24x7 and NDTV India. Like us on Facebook or follow us on Twitter and Instagram for latest news and live news updates.