The Justice Department is entitled to records of the Twitter accounts used by three current and former WikiLeaks associates, a federal judge ruled Thursday, dealing a victory to prosecutors in a routine records demand that turned into a fierce court battle over online privacy and free speech.

In a 60-page opinion (PDF), US District Court Judge Liam O’Grady in Alexandria, Virginia upheld a magistrate’s decision earlier this year allowing prosecutors to obtain information on the accounts, including records showing when they sent direct messages to one another, and from what Internet IP addresses. The ruling does not expose the content of the messages, nor information on other Twitter users who follow the accounts.

The case has been dragging through the courts since December of last year. At one point oral arguments had been scheduled for April, but Judge O’Grady canceled the hearing and indicated he would rule based on the written arguments.

O'Grady also rejected arguments by civil rights groups that sealed court filings in the case, and basic docketing information in related records demands, should be unsealed. Google and the Internet service provider Sonic.net have reportedly responded to similar records demands on the WikiLeaks associates, in cases that remain under seal.

The Justice Department has been seeking the Twitter records under 18 USC 2703(d), a 1994 amendment to the Stored Communications Act that allows law enforcement access to non-content Internet records, such as transaction information, without demonstrating the "probable cause" needed for a full-blown search warrant. A 2703(d) order is issued when prosecutors provide a judge with "specific and articulable facts" that show the information they seek is relevant and material to a criminal investigation. The people targeted in the records demand don’t themselves have to be suspected of criminal wrongdoing.

The targets of the records demand are WikiLeaks' official Twitter account, and the accounts of three people connected to the group: Seattle coder and activist Jacob Appelbaum; Birgitta Jonsdottir, a member of Iceland’s parliament; and Dutch businessman Rop Gonggrijp. Jonsdottir and Gonggrijp helped WikiLeaks prepare the release of a classified US Army video published last year as "Collateral Murder," and Appelbaum is the group’s US representative.

The records demand appears to part of a grand jury investigation probing WikiLeaks for its high-profile leaks of classified US material. WikiLeaks founder Julian Assange hasn’t challenged the demand for records pertaining to the organization’s feed, but the other three have been fighting the case with the help of the American Civil Liberties Union and the Electronic Frontier Foundation—who will now likely take their arguments to the US Fourth Circuit Court of Appeals in Richmond, Virginia.

Among other things, the groups argued that the records demand trammels on the WikiLeakers’ constitutional right to free speech and association.