Bernard Madoff must submit to a deposition by lawyers for some former customers who lost money when the imprisoned swindler's firm collapsed in December 2008, a judge ordered on Friday.

U.S. Bankruptcy Judge Stuart Bernstein in Manhattan set strict limits on what Madoff can be asked.

He restricted questions to the meaning of more than 91,000 transactions recorded as "profit withdrawal" on the books of the former Bernard L. Madoff Investment Securities LLC.

The judge also said whatever Madoff says can be used only in litigation over the profit withdrawal issue, and that Madoff must be instructed in advance not to wander off topic.

Madoff, 77, would be deposed at the North Carolina prison where he is serving a 150-year sentence for running a huge Ponzi scheme.

It is unclear when the deposition will take place.

Former customers who sought the deposition said only Madoff would know how to properly account for profit withdrawals.

They hope whatever he says might help them show they lost more money with him than courts and Irving Picard, the trustee liquidating Madoff's firm, have credited them.

Some customers are also pursuing litigation targeting third parties that they believe aided Madoff's fraud.

Picard has recouped roughly $11.1 billion of the estimated $17.5 billion of principal he has said Madoff's customers lost.

The case is Securities Investor Protection Corp v. Bernard L. Madoff Investment Securities LLC, U.S. Bankruptcy Court, Southern District of New York, No. 08-01789.