SAN FRANCISCO (Reuters) - Twitter Inc on Thursday filed a federal lawsuit to block an order by the U.S. government demanding that it reveal who is behind an account opposed to President Donald Trump’s tough immigration policies.

Twitter cited freedom of speech as a basis for not turning over records about the account, @ALT_uscis. The account is claimed to be the work of at least one federal immigration employee, according to the lawsuit filed in San Francisco federal court.

The acronym U.S. CIS refers to U.S. Citizenship and Immigration Services, and the account describes itself as “immigration resistance.” Trump has vowed to build a wall along the U.S. border with Mexico and has promised to deport millions of illegal immigrants.

Following Trump’s inauguration in January, anonymous Twitter feeds that borrowed the names and logos of more than a dozen U.S. government agencies appeared to challenge the president’s views on climate change and other issues. They called themselves “alt” accounts.

Twitter spokesman Nick Pacilio declined to comment on whether the government had demanded information about other accounts critical of Trump.

Twitter, which counts Trump among its active users, has a record of litigating in favor of user privacy.

"The rights of free speech afforded Twitter's users and Twitter itself under the First Amendment of the U.S. Constitution include a right to disseminate such anonymous or pseudonymous political speech," Twitter said in the lawsuit. (tmsnrt.rs/2p6CnXp)

The 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, and the White House had no immediate comment.

Senator Ron Wyden, an Oregon Democrat, said in a statement it was a waste of resources to try to uncover an anonymous critic, and he called on the Homeland Security inspector general to investigate who directed the “witch hunt.”

Esha Bhandari, a staff attorney with the American Civil Liberties Union, which is representing the Twitter user, said the government’s request was highly unusual. Requests for social media account information from the U.S. government typically involve national security or criminal charges, 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 U.S. Constitution.

Shortly after the lawsuit became public, @ALT_uscis tweeted a copy of the First Amendment and a picture of part of the lawsuit. The account’s followers nearly tripled to 89,000 in the hours after the news broke.

For weeks the account has posted criticism of the administration. It tweeted a parody of the game “bingo” for “right-wing idiots,” said that some anti-immigration advocates must have been dropped on their head at birth, and mocked Trump for not giving more of his wealth to charities.

Twitter said it received an administrative summons last month demanding that it provide records related to the account. (tmsnrt.rs/2oKlWnk)

A copy of the summons filed with the lawsuit says the records are needed for an investigation to ensure compliance with duties, taxes and fines and other customs and immigration matters.

It was not immediately clear how the anonymous account fit into those laws and regulations, and Twitter said the summons was an abuse of a law meant to be used to investigate imported merchandise.

Twitter might have a strong case that the summons was improper, said Paul Alan Levy, staff attorney at Public Citizen Litigation Group who specializes in online privacy and free speech issues.

The logo for the parody immigration Twitter account @alt_uscis. @alt_uscis/Handout via Reuters

“I don’t think there is any way for the government to come out of this looking good,” Levy said.

There is no indication that the White House was aware of the summons, which was signed by a Florida-based supervisor who works in an office that investigates employee corruption, misconduct and mismanagement. The supervisor could not be reached for comment.

The summons requested, but apparently did not order, that Twitter keep the document private.

The social media company has a history of challenging 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 who threatened the company with sanctions, and the protester pleaded guilty to disorderly conduct.

Twitter sued the U.S. Department of Justice in 2014, seeking permission to publicly disclose more information about requests it gets from U.S. 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.