Criminal Court Judge Matthew A. Sciarrino struck down Twitter's request to quash a subpoena from the Manhattan district attorney for the Twitter posts and data from Brooklyn resident Malcolm Harris, CNN reported.
Sciarrino said freedom of speech applies to Twitter, but "that is not the same as arguing that those public tweets are protected."
"There can be no reasonable expectation of privacy in a tweet sent around the world," the judge wrote.
Twitter had claimed complying with the prosecutor's request would violate U.S. privacy laws.
"We are disappointed in the judge's decision and are considering our options," a Twitter representative said in a statement. "Twitter's terms of service have long made it absolutely clear that its users own their content. We continue to have a steadfast commitment to our users and their rights."
Harris was arrested with 700 people during an Oct. 1, 2011, protest and charged with disorderly conduct.
If Twitter complies with the request, prosecutors would get not only Harris' Twitter posts, which have since been deleted, but also other information that could be evidence, including Harris' Internet provider address, e-mail address and location information at the time of the arrest, CNN said.
Aden Fine, a staff attorney for the American Civil Liberties Union, criticized the ruling in a blog post.
"The government shouldn't be able to get this sensitive and constitutionally protected information without a warrant and without first satisfying First Amendment scrutiny," Fine wrote.
Twitter's terms of service state, "We also reserve the right to access, read, preserve, and disclose any information as we reasonably believe is necessary to (i) satisfy any applicable law, regulation, legal process or governmental request ... ."