(Reuters) - One late-night visit by the FBI was all it took for the notorious hacker known as Sabu to switch sides and become a valued snitch.

Hector Xavier Monsegur cooperated immediately in June, helping investigators close a net around five other leaders of the international hacking group Anonymous, according to court documents made public on Thursday.

Monsegur sometimes stayed up all night, talking with co-conspirators to help the government build its case, Assistant U.S. Attorney James Pastore told a Manhattan federal court judge at a secret hearing days before Monsegur's August 15 guilty plea, the court papers showed.

Monsegur, 28, was arrested at his small apartment in a Manhattan housing complex on June 7, U.S. authorities said on Tuesday in announcing charges against him and five others. The precise time, 10:15 p.m., was revealed in Thursday's court papers.

Since literally the day he was arrested, the defendant has been cooperating with the government proactively, Pastore told Judge Loretta Preska.

Monsegur was freed on $50,000 bond the day after his arrest. He later pleaded guilty to each of the 12 computer crimes he was charged with in cases brought in four different states. The cases were later consolidated in New York.

Federal prosecutors said Monsegur had confessed in court after signing a cooperation agreement with the government. Details of the deal and any reduction in prison time that he hopes to receive will not be known until the court makes the information public.

Monsegur and the five others were senior members of Lulz Security (LulzSec), an offshoot of Anonymous that took credit for hacking attacks on government and private sector websites, U.S. authorities said on Tuesday. Targets included the CIA, Britain's Serious Organised Crime Agency, Japan's Sony Corp and others including in Ireland and Mexico.

Among those publicly charged this week was Jeremy Hammond, known as Anarchaos, who was arrested in Chicago on Monday on suspicion of hacking into Strategic Forecasting Inc, or Stratfor, a global intelligence and research firm, in December 2011.

Federal prosecutors also brought U.S. cases against Donncha O'Cearrbhail, 19, and Darren Martyn, 25, of Ireland as well as Jake Davis, 19, and Ryan Ackroyd, 23, of Britain.

Anonymous and its offshoots such as LulzSec and AntiSec were initially focused on fighting attempts at Internet regulation and blocking free illegal downloads, but have since taken on other targets including Scientology and the global banking system.

Anonymous - and LulzSec in particular - became notorious in late 2010 when they launched what they called the first cyber war in retaliation for attempts to shut down the Wikileaks website.

They attacked websites such as MasterCard.com that tried to block payments to Wikileaks after apparent pressure from the U.S. government following the release of thousands of diplomatic cables.

LIVING ON $400 A MONTH

As a LulzSec leader, Monsegur took responsibility for attacks on the websites of eBay Inc's PayPal, MasterCard Inc and Visa Inc between December 2010 and June 2011, according to court papers.

Despite the severity of the charges against Monsegur - the prison term could total up to 122 years - federal prosecutors argued that he should remain free on bail under the supervision of the FBI. It is highly unlikely that Monsegur would receive consecutive prison sentences.

Born in New York, Monsegur attended college and worked at technology jobs, displaying a rare combination of hacking talent, working-class sensibility and political conviction. He said he first hacked for a cause more than a decade ago when he interfered with communications during controversial U.S. Navy bombing exercises in Vieques, Puerto Rico.

At the time of his arrest in June, Monsegur was unmarried and collecting a $400 unemployment check every month, a court document showed. He had been living in a small apartment on the sixth floor of a 14-story brick housing project on Manhattan's Lower East Side, overlooking a busy highway.

The document, which detailed his bail conditions and was made publicly available on Thursday, also showed that Monsegur was paid $6,000 a month at his last job, which he said he held until April 2010. Monsegur also stated that he had parental custody over his two nieces, aged 4 and 5.

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