The day before five phone companies were to answer Zulima Farber’s subpoena over whether they gave caller information to the National Security Agency without a court order, she got a response — but it was hardly the one she had sought.

The New Jersey attorney general found herself a defendant in a suit by the federal government, alleging that her inquiry threatened national security and was barred by the state secrets privilege.