The Occupy Wall Street protester who tried to prevent prosecutors from gaining access to his tweets on Twitter pleaded guilty yesterday to disorderly conduct and was sentenced to six days community service at a private nonprofit of his choice.

The OWS protester faced a maximum of 15 days in jail after his arrest in October 2011 for blocking the roadway during a march on the Brooklyn Bridge.

Harris will appeal the ruling and continue to fight the legality of social media searches, a key argument throughout his case, according to his lawyer, Martin Stolar.

At the brief hearing in Manhattan Criminal Court, the tweet that had not been made public for the past 14 months was finally revealed: “We took the bridge,” it said.

Joined by high-powered Twitter lawyers, Harris lost a bid to block a subpoena from the Manhattan District Attorney’s office seeking to admit his tweets as evidence in the case.

Judge Matthew Sciarrino had ordered Twitter to turn over three months’ worth of messages to the DA, which the microblogging service did in September. The judge did not immediately make the tweets public, however.

The messages had been purged from Twitter’s files, which is why the DA issued the subpoena.

Harris and other protesters claimed police led them onto the bridge in a setup to arrest them. The DA argued that Malcolm’s tweets would show that the protesters knew they shouldn’t have been there.

Several tweets disclosed in court supported the feds’ case. “They tried to stop us,” according to one.

Another tweet said police didn’t lead them onto the bridge, and another said they tried to block them and threatened arrest.

In a third tweet, Harris seemed to brag about the success and scope of the protest, and characterized it as more than simple acts of civil disobedience: “Sabotaging vital transportation arteries is never simply ‘peaceful protest.’ ”

Twitter argued that users like Harris have the right to challenge law enforcement searches, but the courts have said that only the microblogging service can challenge the warrants and subpoenas for its records.

Yesterday, a Twitter representative was at the courthouse and prepared to testify on behalf of prosecutors to authenticate the evidence.