SAN FRANCISCO — The American Civil Liberties Union and the Electronic Frontier Foundation have filed an amicus brief in a Northern California drug trafficking case that could provide the first opening for a federal judge to assess the legality of a newly exposed government surveillance program.

The groups filed the brief Tuesday backing a motion to compel discovery made by a defendant implicated in a drug trafficking ring that spanned California and the Pacific Northwest. Nearly 750,000 calls were analyzed during the investigation, but the government has not explained how it acquired much of the data, the groups argue in the brief.