An anarchist journalist who had been jailed for refusing to testify before a grand jury was freed from prison Tuesday after striking a deal with prosecutors.

Joshua Wolf, 24, posted online unaired videotape that he had refused to give authorities, federal prosecutor Jeffrey Finigan said in court papers.

Because of that, U.S. District Judge William Alsup, who had jailed Wolf for 226 days in a California prison, approved his release.

"I will not under any circumstances testify before a grand jury," Wolf said as he left prison.

Wolf had been held for refusing a subpoena to turn over videotape he shot of a chaotic 2005 San Francisco street protest against the G-8 summit happening a continent away in Scotland.

The government was investigating how a San Francisco police officer got his skull fractured during the melee and the alleged torching of a police car.

The footage Wolf posted Tuesday does not capture the alleged crimes authorities are investigating, defense lawyer David Greene said.

As part of the deal, prosecutors said they were not inclined to seek Wolf's grand jury testimony, but left open that possibility.

Wolf's lawyers argued that the First Amendment gave him the right to refuse the subpoena to turn over the rest of his tape.

But Alsup cited a 1972 U.S. Supreme Court ruling that the U.S. Constitution does not entitle reporters, or anybody else, to withhold their confidential sources or unpublished material in a grand jury investigation or criminal trial.

The Associated Press contributed to this report.