Legendary hacker Hector Monsegur avoided further jail time on Tuesday and was lauded by a Manhattan federal judge for his "extraordinary" help to the government in the three years since he was charged with masterminding a cybercrime conspiracy."That personal characteristic of turning on a dime and choosing to do good instead of evil is the most important factor," said U.S. District Judge Loretta Preska, who credited Monsegur with helping thwart an attack on a major city's water supply system along with other feats.

Monsegur, 30, was a central player in the hacking groups "Anonymous" and "LulzSec," known for multiple intrusions into private and public computer systems. Arrested in 2011, he quickly pleaded guilty to conspiracy, computer hacking, fraud and identity theft, and became a government informant.

Defense lawyers said he was primarily motivated by a desire to keep his family together. He had just become the foster parent to two cousins. Prosecutors said he aided in identifying and prosecuting former collaborators, and in thwarting more than 300 attacks.

"The last three years I have gone through a lot of changes, learned a lot of lessons," Monsegur, a largely self-taught hacker from New York City known online as 'Sabu,' told the judge. "I assure you I will not be in this courtroom again."

Monsegur was jailed for seven months in 2012 for making unauthorized postings while he was working as an informant. That seven months "time served" was the only jail time imposed by Preska, who offered him a "salute" for turning over a new leaf.

"You obviously have a great skill," she said. "To employ that skill for good would be a great thing . . . I look forward to reading about you deploying your great skills for good."

Monsegur's cooperation with the government was made public shortly after it began, his defense lawyers said, in hopes that it would deter some hacking threats. He has received multiple threats, and is keeping details of his current residence secret, they said.

Lawyer Phil Weinstein said he is now looking for a job, but is also provided information in some as-yet unfilled cases that are likely to lead to new arrests and indictments.

"The help he provided has probably not come to an end," Weinstein said.