A federal appeals court ruled in favor of American International Group Inc by concluding that the insurer's $10 billion lawsuit against Bank of America Corp over mortgage losses belongs in state court, not federal court.

The 2nd U.S. Circuit Court of Appeals on Friday threw out a lower court order denying AIG's bid to move the case to a New York state court. AIG's lawsuit was filed in August 2011 but has been largely on hold because of the venue fight.

AIG accused Bank of America and its Countrywide and Merrill Lynch units of making fraudulent misrepresentations in connection with $28 billion of residential mortgage-backed securities in 349 trusts that AIG bought, causing large losses.

Bank of America did not immediately respond to requests for comment. An AIG spokesman had no immediate comment.

The appeal involved interpreting the Edge Act, a 1919 law adopted to support foreign trade, which lets federal courts hear civil lawsuits against U.S. companies over banking transactions that are international or in a U.S. territory.

AIG said that of the 1.7 million mortgages underlying the trusts, just 27 involved property in U.S. territories, including Guam, the Northern Mariana Islands, Puerto Rico and the U.S. Virgin Islands, court papers show. It said that wasn't enough to make federal jurisdiction appropriate.

U.S. District Judge Barbara Jones in Manhattan agreed with Bank of America that the case belonged in federal court, but asked the 2nd Circuit to review the issue.

Writing for the appeals court, Circuit Judge Pierre Leval said that while the statute was ungrammatical, Bank of America's interpretation of it was "arbitrary and illogical."

He said for federal jurisdiction to apply, a lawsuit must both have a federally chartered corporation as a party and arise out of an offshore banking or financial transaction of that party.

The case is American International Group Inc et al v. Bank of America Corp et al, 2nd U.S. Circuit Court of Appeals, No. 12-1640.