NEW YORK (Reuters) - A U.S. appeals court on Monday threw out a jury’s finding that Bank of America Corp was liable for mortgage fraud leading up to the 2008 financial crisis, voiding a $1.27 billion penalty and dealing the U.S. Department of Justice a major setback.

The 2nd U.S. Circuit Court of Appeals in New York found insufficient proof under federal fraud statutes to establish Bank of America’s liability over a mortgage program called “Hustle” run by the former Countrywide Financial Corp.

The Justice Department claimed Countrywide, which Bank of America bought in July 2008, defrauded government-sponsored mortgage financiers Fannie Mae and Freddie Mac by selling them thousands of toxic loans.

But in a 3-0 decision, U.S. Circuit Judge Richard Wesley said the evidence at most showed that Countrywide breached contracts to sell investment-quality loans, and that there was no proof it intended any deception.

“The trial evidence fails to demonstrate the contemporaneous fraudulent intent necessary to prove a scheme to defraud through contractual promises,” Wesley wrote.

Bank of America said it was pleased with the ruling. A spokesman for Manhattan U.S. Attorney Preet Bharara, whose office pursued the case, had no immediate comment.

The lawsuit was filed in 2012 following a whistleblower’s complaint, and remains one of the biggest government enforcement cases to go to trial in connection with the U.S. housing meltdown and financial crisis.

A federal jury had in 2013 found Bank of America and Rebecca Mairone, a former midlevel Countrywide executive, liable for fraudulently selling shoddy loans originated through its “High Speed Swim Lane” program, also called HSSL or “Hustle.”

The Justice Department said the program rewarded staff for generating more mortgages and emphasizing speed over quality, and resulted in Fannie Mae and Freddie Mac being lied to about the quality of loans they bought.

Fannie Mae and Freddie Mac were seized by the government in September 2008 and remain in conservatorships.

Following the verdict, U.S. District Judge Jed Rakoff in 2014 imposed a $1.27 billion penalty on Bank of America and ordered Mairone to pay $1 million.

Bank of America was sued under the Financial Institutions Reform, Recovery and Enforcement Act of 1989, a law adopted after the 1980s savings and loan scandal targeting conduct “affecting” federally insured financial institutions.

The Justice Department has relied on FIRREA for several financial crisis-linked cases in part because it provides 10 years from the time of the alleged fraud to bring cases.

Joshua Rosenkranz, a lawyer for Mairone, called the case “a massive government overreach,” and said Monday’s decision could have ramifications for other mortgage-related enforcement actions against banks.

But he said the decision was also narrow because it did not address a closely watched issue over whether the government could sue a bank under FIRREA for conduct “affecting” itself.

No appeals court has addressed that issue, which has emerged in other cases against banks.

The case is U.S. v. Countrywide Home Loans Inc et at, 2nd U.S. Circuit Court of Appeals, No. 15-496.