In July 2007, the nation’s largest ratings agency, Standard & Poor’s was considering whether to downgrade a range of mortgage bonds that had earlier gotten the company’s seal of approval. Pressure was increasing inside the company to reveal the toxic nature of these securities.

But there was a problem, according to an e-mail exchange between an S&P analyst and an investment banker.

“Leadership was concerned of p*ssing off too many clients,” wrote the S&P analyst.

The response from the investment banker: “We pay you to rate our deals, and the better the rating the more money we make?!?! Whats up with that? How are you possibly supposed to be impartial????”

That conversation was detailed in a 128-page lawsuit unveiled by the Justice Department on Tuesday that accused S&P of deliberately awarding safe grades to toxic mortgage securities so the company could increase its profits.

Government lawyers said S&P’s actions in 2007 during the run-up to the financial crisis make it liable for at least $5 billion in damages, making the case one of the highest-profile attempts by the federal government to prosecute those responsible for the country’s economic meltdown four years ago.

The lawsuit against S&P is also the first major enforcement action against one of the nation’s big ratings agencies, which have been frequently blamed for playing a major role in causing the nation’s financial crisis.

A coalition of 14 states and the District of Columbia filed lawsuits Tuesday against S&P alongside the Justice Department. The states include Arizona, California, Illinois, Iowa and Pennsylvania.

Justice Department lawyers are charging the company with bank fraud, as well as mail and wire fraud. The case was brought under a law passed in 1989 in the wake of the savings-and-loan crisis that allows the department to seek civil penalties equal to how much money was lost by financial institutions.

S&P released a statement Tuesday saying the lawsuits were “meritless.”

“Claims that we deliberately kept ratings high when we knew they should be lower are simply not true,” said S&P, which is owned by McGraw-Hill.

The firm has argued it was not the only ratings agency that gave top grades to the complex financial products in question during this period — and that others, including U.S. government officials, missed the coming housing bust, as well.

Major cases to come out of the Justice Department related to the financial crisis:

“Although we deeply regret that these 2007 [collateralized debt obligation] ratings did not perform as expected, 20/20 hindsight is no basis to take legal action against the good-faith opinions of professionals,” the company said.

The actions of S&P and other ratings agencies, such as Moody’s, have drawn criticism because they issued top ratings for toxic securities whose values were based on residential mortgages. These ratings caused investors to think the products were safe, but when housing prices nose-dived, the securities lost their value, nearly wiping out the finances of the biggest banks in the country.

Many experts have argued that the ratings agencies had a conflict of interest since they were being paid for their analysis by the banks whose products they were rating.

Justice Department lawyers argue that S&P is not being blamed for failing to see the drop in housing prices.

“It’s not about predicting the future,” Tony West, acting associate attorney general, said at a news briefing. “It’s really about promising to do one thing and doing something else.”

The Justice Department has come under fire for not pursuing criminal cases against those responsible for the crisis. Tuesday’s lawsuit is a civil suit seeking financial penalties.

Moody’s, another of the country’s big ratings agencies, was notably not included in this lawsuit, even though many analysts say its behavior during that time was at least as egregious as S&P’s. The banks that issued the flawed products were also not charged.

Justice Department officials declined to answer questions about whether any lawsuits were pending against Moody’s or any banks.

S&P received attention in Washington in 2011 when it downgraded the U.S. debt for the first time in the country’s history, citing dangerous “political brinkmanship” over the debt ceiling. When asked whether the Justice Department’s lawsuit had anything to do with S&P’s downgrade, Attorney General Eric H. Holder Jr. said, “They are not in any way connected,” adding that department lawyers focused solely on the facts of the case.

The Dodd-Frank financial regulatory overhaul passed in 2010 includes an amendment from Sen. Al Franken (D-Minn.) designed to address possible conflicts of interest at the rating agencies. The amendment would create a board that would assign structured financial products to certain agencies, rather than allow banks to pick and choose which agencies to use. The Securities and Exchange Commission has yet to implement the amendment. The agency’s planned next step is to hold a roundtable on the provision.