Former Merrill Lynch CEO John Thain was ordered by a New York court to testify on Tuesday on bonuses paid out to Merrill executives just before the brokerage giant merged with Bank of America.

The decision, by a state Supreme Court judge, came after New York State Attorney General Andrew Cuomo filed a motion Monday saying that Thain, who was ousted shortly after the merger, had refused to provide more information about the compensation.

Cuomo's office alleged that Thain didn't answer the questions under instructions from Bank of America , and as a result, the bank is interfering with its investigation of the bonus payments.

Cuomo has been investigating $3.6 billion in bonuses Merrill Lynch executives received less than a month before the company completed its sale to Charlotte, N.C.-based Bank of America, and whether investors were properly informed about Merrill's finances.

The payments came as New York-based Merrill was on the brink of reporting a more than $15 billion fourth-quarter loss. The investment bank was among the hardest hit by the ongoing credit crisis.

The bonuses stirred controversy because Merrill's bigger than expected loss prompted Bank of America to seek more government bailout money to complete the acquisition. The government agreed to give Bank of America an additional $20 billion in January to absorb Merrill.

Merrill set those bonuses Dec. 8, according to the court filing. At the time Merrill set the bonuses, it had anticipated losses that were $7 billion less than what its actual results eventually were, the filing said.

Despite the actual results, the bonus pool was not altered, according to the filing. During his deposition Thursday, Thain indicated Bank of America was deeply involved in paying out the Merrill bonuses.

Earlier this month, Cuomo subpoenaed Bank of America's chairman and chief executive Ken Lewis, as he investigates the timing of the bonuses.

Last month, Cuomo subpoenaed Thain and Bank of America's chief administrative officer, J. Steele Alphin.

When questioned about the Merrill bonuses during Congressional testimony Feb. 11, Lewis said he had "very limited" involvement in the decision making regarding the payments.

Lewis said: "We had no authority to tell them what to do to. Just urge them what to do. We did urge."

Bank of America has also repeatedly said that Merrill Lynch was an independent company last year, and its board of directors had ultimate approval over how much to pay employees.

Lewis testified before a Congressional committee along with other banking executives whose firms have received funds from the government.

The government helped orchestrate the acquisition of Merrill by Bank of America over the same weekend in September that another investment bank, Lehman Brothers, went under, setting off the most intense period of the financial crisis.

More from CNBC.com: