By Basil Katz

NEW YORK (Reuters) - A computer hacker-turned-FBI informant known as "Sabu" combined daring online attacks against governments and major companies with a life of petty crime and drugs, according to a copy of his plea agreement.

The court document, made public late on Thursday, describes how authorities agreed not to charge the hacker, whose real name is Hector Monsegur, with a variety of crimes he allegedly committed as long as he obeyed the terms of his plea deal.

Monsegur, 28, was arrested at his small apartment in a Manhattan housing complex on June 7, 2011 and two months later pleaded guilty to 12 computer crimes, prosecutors and the FBI said this week in announcing charges against him and five others.

All six were top members of LulzSec, an offshoot of the loose-knit cyber-activist hacking group Anonymous, authorities contend. The government says Monsegur became a secret FBI mole almost immediately after his arrest.

On two different occasions, Monsegur tried to sell a combined total of five pounds of marijuana, according to his August 15, 2011 cooperation agreement. In 2010, he owned a handgun that was not permitted in New York state. That same year, the document showed, Monsegur made $15,000 worth of unauthorized purchases on his then-employer's credit card. Prosecutors also listed "his purchase of various electronics and jewelry, in or about 2010, that he believed at the time to have been stolen."

Monsegur's court-appointed lawyer, Peggy Cross, could not be reached for comment on Friday.

Monsegur was freed on $50,000 bond the day after his arrest last year and later pleaded guilty in U.S. District Court in New York to charges brought in four states. The cases were consolidated in New York.

The cooperation agreement also said that while the charges carry up to 122-1/2 years in prison, with a mandatory minimum 2-year sentence, prosecutors would recommend a more lenient prison term provided he obey the terms of the deal.

The case is U.S. v. Hector Monsegur, U.S. District Court, Southern District of New York, no. 11-666.

(Reporting By Basil Katz; Editing by Richard Chang)