A man serving a 19-year prison sentence for environmental terrorism won an early release from prison on Thursday, with a California judge approving a settlement between defense lawyers and prosecutors that acknowledged that the authorities had withheld documents during his criminal trial.

The man, Eric McDavid, 37, was convicted in 2007 of conspiring to bomb several targets near Sacramento as part of a radical environmental campaign. The authorities said he plotted attacks against government and commercial facilities that he believed were harming the environment, including cellphone towers and the Nimbus Dam in California. Mr. McDavid, who visited some sites and at one point tried to make homemade explosives, has served nine years in prison and will be released immediately.

His prosecution had become well known in environmental circles partly because of its star witness: a pink-haired informant who began covertly working for the F.B.I. at 17 after writing a community college paper about infiltrating political protest groups.

Mr. McDavid’s lawyers had asked that his conviction be vacated, saying that the federal authorities had withheld information that could have bolstered his defense at trial, including a request by officials for a polygraph examination of the informant, code-named Anna, and various messages between her and Mr. McDavid.