When the Department of Homeland Security’s attempt to unmask an irksome Twitter account imploded last year, few within the agency were surprised, according to newly released records. “Why would we do this?” one official asked in early April 2017 after Twitter filed a complaint in federal court, according to the heavily redacted emails. The short-lived investigation into @ALT_USCIS, an anonymous account that claims it’s run by a U.S. Citizenship and Immigration Services employee, sparked an uproar over First Amendment encroachments and potential abuses of power last year, including from members of Congress.

The new documents, released last week by the Reporters Committee for Freedom of the Press after it sued the DHS and Customs and Border Protection, reveal a partial timeline of the abortive investigation. But more importantly, the emails show how a seemingly unsupervised CBP agent improperly attempted to force Twitter to produce records on a particular user without a court order — completely disregarding whether the summons was legal. “These documents make clear that the CBP needs to focus on real security issues, rather than abusing its authority to discover the identity of a whistleblower,” said Sen. Ron Wyden, D-Ore., who demanded answers from CBP Commissioner Kevin McAleenan last year. The investigation into @ALT_USCIS started in late February 2017, according to the emails. On February 22, McAleenan saw a tweet in which @ALT_USCIS encouraged anyone with “personal dirt” on dishonest CBP and ICE agents to get in touch. The tweet offered payment and anonymity for tipsters.

Hi, If you have personal dirt related to any DISHONEST ICE or CBP officer, please email [email protected] We will protect ur identity & pay! — ALT- Immigration ? (@ALT_uscis) February 22, 2017

A senior CBP official named Patrick Flanagan asked the agency’s Office of Professional Responsibility to look into this tweet and another in which @ALT_USCIS shared an “email dump” allegedly from five CBP officers celebrating Trump’s election. @ALT_USCIS quickly deleted the email tweet, saying the emails “could be bogus.” A technical staffer searched agency accounts for emails to and from the tip account, as well as for messages containing keywords from the email dump, according to the released emails. The staffer was aware of the legal sensitivity of the search. Before reporting results, the staffer looped in another official, writing in one email, “I wanted to make you aware of this request for its legality.” It’s unclear if these searches turned up anything useful. It’s also unclear when such concerns over legality faded away, as leadership pressed to find out the identity behind @ALT_USCIS. “I wanted to confirm your staff is running this to ground,” Flanagan wrote to OPR in early March. The same day, he pressed the technical staff on whether they had any luck “identifying individuals” via the searched emails. On March 14, 2017, CBP agent Adam Hoffman faxed a four-page summons to Twitter’s legal office in San Francisco. A supervising special agent, Stephen P. Caruso, signed the summons, which ordered Twitter to turn over a broad swath of information, including “all records regarding the twitter [sic] account @ALT_USCIS to include, User names, account login, phone numbers, mailing addresses, and I.P. addresses.” The trouble was that the order lacked any grounding in law.

One agent wanted agency lawyers to press Twitter to comply, despite acknowledging the summons had wobbly legal support.

In phone calls and emails with Hoffman, Twitter’s attorneys pointed out that the underlying legal authority for this “1509 summons” — which is named for the authorizing law — pertains solely to records about imported merchandise. Hoffman clearly had no justification for slapping a 1509 summons on Twitter to compel them to provide information about @ALT_USCIS. “It looks like no one discussed the summons with OPR or legal, the dude just filled it out, got a supervisor to sign it and sent it out,” @ALT_USCIS told The Intercept over Twitter chat. “That is how casual they are about civil liberties.” An OPR official said investigators should “actually research all the citations of law to ensure the document is applicable,” as word spread around the agency in April 2017. Another worried that the agency’s “admin legal request documents are lacking.” A subsequent review by the Homeland Security inspector general’s office found that OPR staff were generally confused about how to properly use the 1509 summons; they found that at least 1 in 5 such orders issued by Hoffman’s colleagues were in violation of either legal authority or DHS policy.