Twitter Inc has not had a lot to celebrate lately, but a U.S. government demand that it reveal the identity of an account criticizing President Donald Trump’s immigration policies gave the company a chance to assume one of its favorite roles: defender of free speech.

The social media company on Thursday sued the government over a demand by the Customs and Border Patrol that it identify the individual or individuals behind @ALT_uscis, an account claimed to be run by at least one employee of the immigration service.

The news was met with a rare flood of good will toward Twitter from its users – offering respite for a company that has struggled recently to expand its audience, excite investors or attract new revenue streams.

In a 25-page legal filing, Twitter lawyers appeared to revel in their opposition to the Trump administration. Several pages, for example, are dedicated to pictures of tweets from “rogue” government accounts that fact-check statements made by the Trump administration or explain the science behind climate change. (http://tmsnrt.rs/2p6CnXp)

The tweeting styles of such accounts vary greatly, the filing noted, explaining at one point that “some accounts appear to equate the simple act of broadcasting facts as an expression of dissent.”

Trump’s inauguration, the filing continued, was met by “a new and innovative class of American speakers … who provide views and commentary that is often vigorously opposed, resistant or ‘alternative’ to the official actions and policies of the new administration.”

The Trump administration made its demand “without realizing how stingy Twitter is about producing private user data,” said Nu Wexler, a former spokesman for Twitter.

The Department of Homeland Security and Justice Department declined to comment. Twitter also declined to comment.

Twitter once prided itself as representing the “free speech wing of the free speech party,” and has a history of resisting government demands for information about its users. But the company has been forced to temper its approach over the past two years in the face of government pressure to crack down on incitements to violence and user complaints about rampant hate speech and harassment.

As the company has moved in recent months to implement stricter policies intended to limit abuse, legal experts said Thursday’s challenge was an opportunity for Twitter to remind users of some of its long-standing principles.

“Twitter and other social media sites make promises to users about protecting anonymity,” Jane Kirtley, law and journalism professor at the University of Minnesota. “This is a way for Twitter to say, ‘See, we are standing up for your rights.'”

(Additional reporting by Alison Frankel.)