A federal judge imposed a $1.27 billion civil penalty against Bank of America for its role in selling risky mortgages to Fannie Mae and Freddie Mac that were advertised as safe investments, according to Reuters.

The fine was against Countrywide Financial, which Bank of America purchased in 2008 as the financial crisis was unfolding. It is the latest legal ruling against Wall Street, Reuters reported.

A jury found in October 2013 that BofA was liable for Countrywide's role in selling risky loans to the government housing agencies through a program nicknamed the "Hustle" from August 2007 to May 2008, according to Reuters. The jury found that Countrywide executives deliberately misrepresented the quality of mortgages being sold.

In his blunt ruling, Judge Jed Rakoff said the program was "driven by a hunger for profits and oblivious to the harms thereby visited, not just on the immediate victims but also on the financial system as a whole," Reuters reported.

This is the first time a bank or its executives have been found liable under federal law for mortgage fraud leading up to the financial crisis, said Preet Bharara, U.S. Attorney for the Southern District of New York, in a statement, according to Reuters. It is also the first time civil penalties have been imposed on a bank or its executives for mortgage fraud.

"(It is) clear that mortgage fraud cannot be viewed as simply another cost of doing business in the financial world," Bharara said, Reuters reported.

A spokesman for Bank of America, which is based in Charlotte, North Carolina, said the bank is exploring its legal options following Rakoff's decision, including an appeal, according to Reuters.

"We believe (the penalty) simply bares no relation to a limited Countrywide program that lasted several months and ended before Bank of America's acquisition of the company," BofA spokesman Larry Grayson said, Reuters reported.

Countrywide was one of many mortgage companies that sold risky mortgages to Fannie Mae and Freddie Mac leading up to the housing bubble popping and subsequent financial crisis, according to Reuters.

Bank of America, JPMorgan Chase and other big Wall Street banks have paid out billions of dollars in legal settlements for their roles in the financial crisis, Reuters reported.