NEW YORK (AP) -- A computer hacker who helped the government disrupt hundreds of cyberattacks on Congress, NASA and other sensitive targets and cripple the hacktivist crew known as Anonymous will be freed from prison after being sentenced Tuesday to time served.

Prosecutors had detailed Hector Xavier Monsegur's cooperation in court papers while asking a judge to reward him with leniency. He had spent seven months behind bars.

Working around the clock with FBI agents at his side, Monsegur "provided, in real time, information about then-ongoing computer hacks and vulnerabilities in significant computer systems," prosecutors wrote. The FBI estimates he helped detect at least 300 separate hacks, preventing millions of dollars in losses.

He was arrested and pleaded guilty in 2011.

Monsegur first began hacking in a Manhattan apartment in the early 2000s, according to court papers. His aim then was to steal credit card information, then sell it or use it to pay his own bills.

In a 2011 interview with an online magazine, Monsegur said he decided to join forces with Anonymous because he was upset over the arrest of WikiLeaks founder Julian Assange.

Starting in early 2011 and using the alias Sabu, Monsegur led an Anonymous splinter group called Lulz Security, or LulzSec, which hacked the computer systems of Fox television, Nintendo, PayPal and other businesses, stole private information and bragged about its exploits online.

The group was loosely affiliated with Jeremy Hammond, the FBI's most wanted cybercriminal, whose stated objective was to cause mayhem with the attacks, prosecutors said.

When FBI agents showed up at Monsegur's home in the summer of 2011, he immediately agreed to cooperate, giving the FBI a tutorial on the inner workings and participants of LulzSec and Anonymous, prosecutors said.

Under their direction, he "convinced LulzSec members to provide him digital evidence of the hacking activities" and "asked seemingly innocuous questions that ... could be used to pinpoint their exact locations and identities," court papers said.

___

Associated Press Writer Tom Hays contributed to this report.