Litigation involving MBIA Inc. has been keeping investors on edge for about four years now, as the bond insurer has waged war with the banks whose financial products it insured in the run-up to the economic crisis. It’s also generated some wrenching reversals of fortune for the lead lawyers battling over MBIA’s 2009 restructuring, which the banks say allowed the company to shirk its obligations to structured finance policyholders.

The latest victory–and it’s a big one–belongs to Marc Kasowitz of Kasowitz Benson Torres & Friedman. In a 59-page decision issued on Monday, New York Supreme Court justice Barbara Kapnick sided with Kasowitz and the New York State Insurance Department and refused to overturn the state’s decision to approve the MBIA transaction.

The decision is a blow for Bank of America Corporation and Societe Generale SA, the only two banks remaining in the so-called Article 78 proceeding before Kapnick, and their top lawyer, Sullivan & Cromwell’s Robert Giuffra Jr. Giuffra had argued during a closely watched quasi-trial last summer that the restructuring allowed MBIA to shield billions in assets from the banks, and that state regulators never should have approved it.

Kapnick made it clear ahead of the trial that Giuffra would have to prove that former state insurance superintendent Eric Dinallo abused his discretion in approving the MBIA transaction, and she restricted him from invoking "all the intentional and terrible things" MBIA allegedly meant to achieve with its restructuring.

In the end, Kapnick ruled that the banks couldn’t meet their burden. "The issue before this Court is whether there was a rational basis for the [approval], or whether it was an arbitrary decision," the judge wrote in Monday’s decision. "This court cannot say that it was arbitrary and capricious for the NYID not to have taken the course that Petitioners insist, after the fact, would have been more prudent."

The ruling sent MBIA’s shares up 21 percent during daytime trading on Monday. But the insurer isn’t out of the woods yet, since Kapnick’s decision doesn’t affect parallel fraud claims the banks have brought against MBIA.

Sister publication the New York Law Journal has more on Monday’s decision here.

MBIA spun off its relatively healthy municipal bond insurance business from its crippled structured finance division in February 2009, transferring $5.4 billion in capital into the new entity, National Public Finance Guarantee Corporation. MBIA argued that it would still be able to pay policyholders in full, and that the transaction would allow it to stave off a costly bankruptcy proceeding. A Winston & Strawn team led by Lawrence Larose advised MBIA on the transaction.

A group of 18 banks sued MBIA in New York state court in May 2009, alleging that the transaction amounted to a massive fraudulent conveyance. An appellate court tossed the case in January 2011, ruling that the banks should have brought an administrative proceeding challenging NYID’s approval of the restructuring under New York’s Article 78 statute. But New York’s top court reinstated the case in June 2011, ruling that both the fraudulent conveyance claims against MBIA and the Article 78 case should go forward in tandem. We got whiplash as the cases bounced around the courts, and we ended up naming both Kasowitz and Giuffra "Litigator of the Week" as they traded victories.

Kapnick held the Article 78 hearing over several days in May and June of 2012. She likened the proceeding to a "glorified oral argument" and a "not-trial trial." David Hogado of the New York attorney general’s office argued for the NYID, with Kasowitz making the case for MBIA.

Guiffra offered a slew of arguments in hopes of clearing the high hurdle of showing that NYID acted in an "arbitrary or capricious" manner. For one thing, Giuffra cited 14 cases that he said stand for the notion that NYID’s approval must be annulled because it rested on false and misleading information. According to the banks, MBIA misled NYID about its financial conditions and the results of various stress tests. In its briefs, MBIA admitted to making some errors in its stress test analysis, but said those errors were not material.

Kapnick rejected the banks’ arguments in Monday’s decision, writing that "none of the fourteen cases cited provide a basis for this Court to annul the Approval Letter." She noted that NYID has a practice of not fact-checking applications to restructure, and that it wouldn’t be proper for her to disturb that practice "absent a violation of law or regulation."

Giuffra told us Monday that the banks plan to appeal.

"This was as thorough and extensive of a hearing of an issue as you could get," Kasowitz said after the ruling came down. "We’re very confident that the ruling will get upheld."