Counsel David Boies, left, for former American International Group CEO Maurice Greenberg speaks during Greenberg's testimony before a House Oversight and Government Reform hearing on "The Collapse and Federal Rescue of AIG and What It Means for the U.S. Economy" on Capitol Hill in April 2009. (Kevin Lamarque/Reuters)

In what can only be described as a Solomonic ruling, a federal court has ruled that the Federal Reserve exceeded its powers in temporarily nationalizing insurance giant American International Group during the financial crisis of 2008, but by doing so caused no harm to AIG shareholders who had demanded as much as $38 billion dollars in compensation.

[A history of the AIG case: We bailed you out, and now you want what ?!?!]

The split decision will likely be appealed by both parties, likely all the way to the Supreme Court. The government will argue that Monday’s decision by Judge Thomas Wheeler of the U.S. Court of Federal Claims would set a dangerous precedent that limits the ability of government to deal with future financial crises. Shareholders, lead by former AIG chief executive Maurice “Hank” Greenberg, will claim that their right not to have 80 percent of their company seized by the government is meaningless if the government is not forced to pay a penalty for doing so.

The decision, following more than three years of legal wrangling and a 37-day trial, was almost a total victory for Greenberg and his superstar attorney, David Boies. Wheeler ruled that the Fed had no power to demand an ownership share in any firm as a condition for making an emergency loan during a financial crisis, agreeing with Boies that the insurance giant was made a political scapegoat by Fed and Treasury officials and a backdoor vehicle for bailing out the world’s biggest banks, whose bailout came with much sweeter terms. Wheeler cited documents and testimony in ruling that Fed officials knew they were on shaky legal grounds in taking control of the firm. Only by creating a legal ruse, the judge found, was the Fed able circumvent the explicit wording of federal law prohibiting it from holding or trading stock in private firms.

“The Government’s unduly harsh treatment of AIG in comparison to other institutions seemingly was misguided and had no legitimate purpose,” Wheeler concluded. Substituting his judgment for that of the secretary of the Treasury and the five-member Federal Reserve Board, Wheeler — a onetime tax attorney — concluded that the government could have just as easily prevented a financial meltdown by bailing out AIG the same way it had bailed out the big banks, lending whatever was necessary until the crisis had passed and the loans could be repaid.

Wheeler did not note, however, a key point. While the government, as bank regulator, could control the behavior of the banks, without an ownership stake it would not have had control over an unregulated global insurance holding company to which it had just made the largest loan in recorded history.

Having essentially bought Boies’s theory of the case, Wheeler could barely hide his reluctance at having to award his clients no damages.  In doing so, he relied on a recent appeals court decision requiring him to consider what would have happened to shareholders if the government had not mounted a rescue.

“The end point for this case is that, however harshly or improperly the Government acted in nationalizing AIG, it saved AIG from bankruptcy,” Wheeler concluded.  “If the Government had done nothing, the shareholders would have been left with 100 percent of nothing.”

As it happens, the bailout turned out well for just about everyone, including Greenberg.  The government got its $187 billion back, along with $22 billion in interest and profits.  And the government no longer owns any of the company.

Correction: A previous version of this post incorrectly stated that a share of AIG today is worth more than it was on the eve of the bailout. That line has been removed.