President Donald Trump. AP Photo/Matt Rourke SAN FRANCISCO — Twitter said in a lawsuit on Thursday that it had received a demand from US officials for records that could reveal the people behind a Twitter account opposed to President Donald Trump. Twitter is challenging the demand in court.

The lawsuit over the anonymous account, claimed to be run by federal immigration employees, was filed in federal court in San Francisco, where Twitter is based.

After Trump's inauguration in January, anonymous Twitter feeds voicing concerns about more than a dozen US government agencies appeared to challenge the president's views on climate change and other issues.

In the lawsuit, Twitter said the account in question, @ALT_USCIS, had been known to "express public criticism of the department and the current administration," but that Twitter and its users were protected under the First Amendment.

The US government, Twitter says in the complaint, "may not compel Twitter to disclose information regarding the real identities of these users without first demonstrating that some criminal or civil offense has been committed, that unmasking the users' identity is the least restrictive means for investigating that offense, that the demand for this information is not motivated by a desire to suppress free speech, and that the interests of pursuing that investigation outweigh the important First Amendment rights of Twitter and its users."

Twitter says the "defendants have not come close to making any of those showings."

A screenshot of the @ALT_USCIS Twitter profile. Twitter

"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 Department of Homeland Security, which is a defendant in the lawsuit, declined to comment on pending litigation.

The American Civil Liberties Union said it was representing the anonymous Twitter user — who has 33,000 followers — and would be filing on the user's behalf soon.

"The right to anonymously speak out against the government is clearly protected by the First Amendment," the ACLU told Business Insider in a statement. "We are pleased to see Twitter standing up for its users' rights, and the ACLU will soon be filing documents in court on behalf of this user.

"To unmask an anonymous speaker online, the government must have a strong justification. But in this case, the government has given no reason at all, leading to concerns that it is simply trying to stifle dissent."

Twitter said it received an administrative summons last month demanding that it provide records related to the account. The acronym CIS stands for Citizenship and Immigration Services, and the account refers to itself in its description as "immigration resistance."

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.

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.

Twitter declined to comment.

Here's Twitter's complaint in full:

(Additional reporting by Dustin Volz in Washington. Editing by Chris Reese and Lisa Shumaker.)