WASHINGTON — The United States sued Bank of America Wednesday for more than $1 billion for allegedly having sold dodgy mortgages to state-controlled mortgage financers Fannie Mae and Freddie Mac.

The government charged that Countrywide -- the mortgage giant now owned by Bank of America -- labeled defective mortgages as good-quality and sold them to the two companies, causing "over $1 billion dollars in losses and countless foreclosures."

The suit says that between 2007 and 2009 Countrywide ran a mortgage origination program called "Hustle" which aimed to quickly process thousands of new mortgages without quality controls and then sell them to Fannie and Freddie.

"The fraudulent conduct alleged in today's complaint was spectacularly brazen in scope," Preet Bahara, the US attorney in New York City, said in a statement.

"Countrywide and Bank of America made disastrously bad loans and stuck taxpayers with the bill," he said.

"This lawsuit should send another clear message that reckless lending practices will not be tolerated."

Countrywide was, at the height of the US housing boom in the 2000s, the largest mortgage origination company in the United States, and resold most of its mortgages to Fannie and Freddie.

When the housing bubble burst over 2006-2007, both Fannie and Freddie, which fund more than half of the home loans in the country, nearly collapsed under the weight of millions of low-quality mortgages they took in from lenders.

The government had to pump $183 billion into the two companies to keep them afloat, and estimates are that it will not recover much of the money.

The case said Bank of America is responsible because it knowingly assumed Countrywide's liabilities when it took the company over in 2008.

Countrywide initiated Hustle in 2007 just as loan default rates were rising and Fannie and Freddie were tightening their loan purchasing requirements to reduce risk, the Justice Department said.

"According to internal Countrywide documents, the goals of the Hustle were high speed and high volume, where loans 'move forward, never backward' in the origination process," the department said.

"To accomplish these goals, the Hustle removed necessary quality control 'toll gates' that could slow down the origination process."

"Countrywide and later Bank of America knowingly originated loans with escalating levels of fraud and other serious defects and sold them" to Fannie and Freddie, it said.