NEW YORK — 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 got a hero’s welcome Tuesday at his sentencing in federal court, where prosecutors hugged him after he was spared more prison time.
US District Chief Judge Loretta A. Preska credited Hector Xavier Monsegur’s ‘‘extraordinary cooperation’’ before saying he won’t serve more than the seven months he spent in prison two years ago. Federal sentencing guidelines had called for more than 20 years in prison.
‘‘It was truly extraordinary,’’ she said of his cooperation, noting he worked around-the-clock for months, disrupting or preventing at least 300 computer hacks over the last three years. ‘‘We don’t often hear of this.’’
She also marveled that Monsegur, 30, of Manhattan, showed ‘‘extreme care’’ for a young cousin for whom he served as a guardian, even as Monsegur was subjected to personal threats so severe that the FBI relocated Monsegur and some family members.
Afterward, a relieved Monsegur hugged prosecutors who had urged leniency.
‘‘I’m not the same person as four years ago,’’ said Monsegur, who was arrested in June 2011 and pleaded guilty two months later.
Prosecutors said he helped disrupt or prevent hacks against divisions of the US government including the armed forces, Congress, courts, and NASA; international intergovernmental organizations; and several private companies, including a television network, a security firm, a video game maker, and an electronics conglomerate.
Prosecutors said he prevented millions of dollars in losses and also pointed out vulnerabilities in infrastructure, including at a US water utility and at a foreign energy company.
In one instance, Monsegur saved the government substantial time and resources by quickly establishing that a claim by Anonymous that it had hacked the US electrical grid was a hoax, prosecutors said.
According to court papers, Monsegur first began hacking in 1999, breaking into thousands of computers over the next four years before trying to grow a legitimate computer security firm from 2004 to 2006.
In 2006, he began to hack into computers for personal gain, stealing credit card information, prosecutors said.
In a 2011 interview with the online magazine New Scientist, Monsegur said he joined 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.
After his arrest, Monsegur immediately cooperated, giving the FBI a tutorial on the inner workings and participants of LulzSec and Anonymous, prosecutors said.