The former right-hand man of disgraced financier Bernard L. Madoff told a New York City jury Tuesday that a crying Madoff revealed to him that his financial empire was a gigantic fraud just before the rest of the world learned the truth nearly five years ago.

Frank DiPascali, Madoff’s former lieutenant and the government’s star witness at the trial of five former Madoff employees, said Madoff called him into his Manhattan office and told him to close the door behind him on a day that Madoff, the former Nasdaq chairman, had spent staring out his window.

“Crying, he said: ‘I’m at the end of my rope. I have no money,’ ” DiPascali told jurors in federal court on the eve of the five-year anniversary of Madoff’s arrest.

When it seemed DiPascali did not understand, Madoff said: “I don’t have any more . . . money! Don’t you get it?” DiPascali recalled, his own voice rising and accelerating so fast that the judge had to direct him to slow down.

DiPascali said he spent several hours in the office listening to Madoff recount his detailed plan to reveal the true nature of a private investment business that had blown nearly $20 billion of money entrusted to him by thousands of investors, including charities, Hollywood actors and producers and the owners of the New York Mets baseball team.

DiPascali said Madoff asked repeatedly if DiPascali’s wife had money and would be okay and said his own wife, Ruth Madoff, had money from her family that was untainted by the business. Madoff predicted that his brother Peter Madoff, a lawyer, “is probably going to get disbarred, but, hey, I’m not going to worry about that.”

Peter Madoff pleaded guilty last year to falsifying documents and lying to regulators as part of the Ponzi scheme and is serving a 10-year prison sentence.

Bernard Madoff, just days after sending out statements implying that the money he managed had more than tripled since he began investing decades earlier, revealed his biggest worry amid his description of “a little game plan” to reveal his house of cards, the witness testified.

“One of the last things I want is to go out of this office in handcuffs in front of all of the employees,” DiPascali said Madoff told him. “I want to do this on my terms.”

DiPascali said Madoff’s revelations hit him hard and they realized “the whole shootin’ match is going right down the toilet . . . and we’re all going to get arrested.”

DiPascali, 57, has been testifying for the past week about his role in fabricating trades that he said began after the stock market crashed in 1987. He is cooperating with the government in the hopes that his testimony leads to a major reduction in any prison sentence. Among those being tried are Madoff’s former longtime secretary, his director of operations, an account manager and two computer programmers.

On Dec. 11, 2008, Madoff was arrested at his Manhattan apartment by FBI agents after he invited them in and acknowledged knowing why they were there.

Several months later, he pleaded guilty to fraud charges, maintained he had acted alone and was sentenced to 150 years in prison. Madoff, 75, is imprisoned in North Carolina.

— Associated Press