After months of secretly working with the FBI, Bernard Madoff's right-hand man emerged in federal court on Tuesday and pleaded guilty to conspiracy and other charges, contradicting claims by the disgraced financier that he acted alone. "I was loyal to him. I ended up being loyal to a terrible, terrible fault," Frank DiPascali told a judge during a hearing at which his long-rumored cooperation deal with the government was confirmed. Madoff is serving 150 years in prison for a pyramid scheme that destroyed thousands of people's life savings, wrecked charities and shook confidence in the financial system. During his guilty plea in March, Madoff insisted that he acted alone. Only one other person - his accountant - had been charged during the seven-month investigation before the charges were revealed against DiPascali. Both prosecutors and defense attorneys portrayed DiPascali as the man who could unlock his former boss's epic pyramid scheme and potentially make cases against other defendants. Since Madoff revealed the fraud to his sons in early December and was arrested by FBI agents, investigators have looked into the actions of his wife, Ruth, his brother and two sons, who ran a trading operation under the same roof, and other insiders. No other Madoff family members have been charged. Attorneys argued the former chief financial officer should be free on bail to help investigators sift through a mountain of evidence. But US District Judge Richard Sullivan surprised both sides by ordering DiPascali jailed immediately - a rarity for a cooperator in a white-collar case who had pleaded guilty. Sullivan said he felt compelled to keep 52-year-old DiPascali locked up after hearing the defendant admit that, at Madoff's direction, he lied to the Securities and Exchange Commission in 2006 when he thought they might discover the fraud. The judge said he was troubled, too, that DiPascali also lied repeatedly "to people who entrusted him with their life savings." Defense attorney Marc Mukasey told Sullivan his client was "completely unprepared for this" and tried several times to persuade the judge to change his mind. He described DiPascali as a genuinely repentant cooperator who won the trust of FBI agents by speaking to them nearly every day since late last year. But in the end, a dejected-looking DiPascali was handcuffed and led out of the courtroom. The cooperation deal may still earn him leniency against charges that carry a potential penalty of up to 125 years in prison for securities fraud, money laundering and other crimes. It was agreed that sentencing won't occur before May 2010. During his plea, DiPascali described himself as a "kid from Queens" in New York City who began working for Madoff in 1975, just after he finished high school. He said he became aware of the fraud by the 1980s or early 1990s. DiPascali said account statements showing the firm was making trades for clients were "all fake" - something "I knew, Bernie Madoff knew and other people knew." He claimed he thought "for a long time" that Madoff had other assets to cover the claims of any investors who might demand their money back. "That's not an excuse. I knew everything I was doing was wrong and criminal," he said.