Free speech advocates said the DHS order appeared to be the first time the government has attempted to use its powers to expose an anonymous critic -- a development that, if successful, would have a "grave chilling effect on the speech of that account" as well as other accounts critical of the U.S. government, Twitter said.
DHS is "unlawfully abusing a limited-purpose investigatory tool" to find out who is behind the @ALT_uscis account, according to Twitter's court filings.
DHS spokeswoman Jenny Burke declined to comment, citing the pending litigation.
The case sets up a potential showdown over free speech between Silicon Valley and Washington, which has tussled over whether tech firms can resist government orders seeking the identity or personal information from criminals and suspected terrorists.
Apple, for instance, declined in early 2016 to unlock the phone of the shooter in San Bernardino, Calif., and has refused to build "back doors" that would enable law enforcement to break into smartphones. The move sparked a pitched battle between the company and the FBI, which eventually paid a private expert to unlock the device.
But the Homeland Security case struck free speech advocates as more remarkable because the information request was about the identity of a government critic, rather than public safety.
"Twitter has a pretty strong argument," said Andrew Crocker, a staff attorney for the Electronic Frontier Foundation. "It does look and smell like the government is going after a critic. There's nothing in the summons that CBP [Customs and Border Protection] sent to Twitter that authorizes this request under the power that they have."
The @ALT_uscis account, which was created in January, has not held back in firing attacks against the Trump administration.
In a Jan. 26 tweet, the @ALT_uscis account tweeted: "Fact: More than 40% of illegal aliens in the US are Visa overstays from other developed countries not sounding like MEXICO #TheResistance."
The account has also called attention to mismanagement in agency operations. In a March 12 tweet, it said that "USCIS turns down regularly private companies who propose collaboration to streamline the intake process, reducing costs and processing time."
The account's description stresses that its views are "Not the views of DHS or USCIS." As of the time of the court filing, the account had been active for two months and amassed more than 32,000 followers. By 8:15 p.m., that figure had grown to more than 86,000.
In its court filing with the U.S. District Court in the Northern District of California, Twitter said that DHS officials delivered an administrative summons to the social-networking site on March 14, via a CBP agent, demanding that the company provide records that would "unmask or likely lead to the unmasking" of the person or people behind the account.
Twitter maintains that CBP does not have jurisdiction to demand such information, which includes "names, account login, phone numbers, mailing addresses, and I.P. addresses," associated with the account.
But its primary objection, the company said, is that allowing the government to unmask Twitter critics violates the Constitution's First Amendment right to free speech. Twitter has defended its users' rights to free expression -- a position it has held for years, notably during the widespread Arab Spring protests in 2011. That right, the company said, is particularly important when discussing political speech.
"First Amendment interests are at their zenith when, as here, the speech at issue touches on matters of public political life," the filing said.
Twitter added that it feared the government wants to punish the person or people responsible for the account. The summons, Twitter said, "may reflect the very sort of official retaliation that can result from speech that criticizes government officials and agencies."
The company also has a lot at stake for its business, which could see a huge hit if anonymous users could suddenly be unmasked by the government. Unlike other social networks, Twitter allows its users to create accounts without publicly revealing their true identity.
This isn't the first time Twitter has tangled with officials over its users' personal information.
The company in 2012 appealed an order from the state of New York to reveal the identity of Occupy Wall Street protester Malcolm Harris. It lost that appeal. Twitter sued the Justice Department in 2014 for the right to make federal information requests for user data public. And it has lent its support to other companies' fights against the government, including Apple's opposition to the FBI order.
The American Civil Liberties Union, which is representing the user in the DHS case, expressed concern that the order is an attempt to curb free speech. "To unmask an anonymous speaker online, the government must have a strong justification," ACLU attorney Nathan Freed Wessler said in a statement. "But in this case the government has given no reason at all, leading to concerns that it is simply trying to stifle dissent."
ACLU said it plans to make its own filing in the court on behalf of the user in the next few days.
"It's about the broader right to speak anonymously on the Internet," said Esha Bhandari, an ACLU staff attorney.
The @ALT_uscis account is one of many "alternative government" accounts that have popped up since Donald Trump's election. Accounts apparently run by employees (or former employees) of the National Park Service, the National Weather Service, the Labor Department and other agencies have appeared to question the Trump administration's policies and fact-check its assertions
on a variety of topics.
The @ALT_uscis account didn't respond to a tweet asking for comment on the suit, but was tweeting about the case and the account's new followers.
Staff writer Craig Timberg contributed to this report