The settlement comes after more than two years of litigation as S&P tried to beat back allegations that it issued overly rosy ratings in order to win more business.

S&P parent McGraw Hill Financial Inc (>> McGraw Hill Financial Inc) said it will pay $687.5 million to the U.S. Department of Justice, and $687.5 million to 19 states and the District of Columbia, which had filed similar lawsuits over the ratings.

Late Monday, the firm reached a separate $125 million settlement with public pension fund California Public Employees’ Retirement System, which had sued S&P in 2009, claiming its inaccurate ratings caused the firm hundreds of millions of dollars in losses.

The United States sued S&P in 2013 after initial settlement talks broke down, seeking $5 billion and accusing the ratings agency of defrauding investors. S&P argued that its ratings were protected under the First Amendment right to free speech, and described the lawsuit as retaliation for the firm downgrading the credit rating of the United States.

Under the settlement, S&P acknowledged it has not uncovered evidence to support the allegations of retaliation. "This was important to me," Attorney General Eric Holder said, referring to the allegation as "utter nonsense."

"290 million documents have been examined. We could look at 290 million more, and you'll find absolutely no indication that was the reason why this investigation was begun, why this settlement was reached," Holder said at a news conference announcing the settlement.

DOJ officials said it was the largest number of documents the Justice Department has ever made available as part of a lawsuit.

Under the deal, S&P did not admit to any violations of law, but it did sign a statement of facts acknowledging that its executives in 2005 delayed implementing new models that produced more negative ratings.

Authorities said the payout from S&P exceeds the company’s profits earned for rating mortgage-backed securities from 2002-2007.

In 2013 McGraw Hill reported a profit from continuing operations of $812 million. It said in a statement on Tuesday that it was "pleased to resolve these matters."

'STRUCTURED BY COWS'

A 2011 congressional report on the causes of the crisis targeted both S&P and rival Moody's Corp (>> Moody's Corporation) for issuing ratings that made the risky mortgage-backed securities central to the crisis appear to be safe investments.

The report concluded that the firms then triggered the worst financial crisis in decades when they were forced to downgrade the inflated ratings.

Mississippi and Connecticut have both sued Moody's, and the Justice Department is also examining the firm's business but the probe remains in a preliminary stage, a person familiar with the matter said.

Connecticut Attorney General George Jepsen, whose office also led the states' pursuit of S&P, said on Tuesday, "These actions had a very direct and serious impact on our national economy that is still being felt in communities and households...across the country."

Illinois, which has the worst-funded state retirement system, earmarked its $52.5 million share of the settlement to its pension funds.

Last summer, the U.S. Securities and Exchange Commission imposed new rules on the rating industry, but it did not ban the issuer-pay model under which the ratings agencies operate. The firms are paid by the banks that issue the securities, a model some liken to a restaurant paying a reviewer.

In its 119-page complaint, the Justice Department said S&P delayed updates to its ratings criteria and analytical models between September 2004 and October 2007, weakening its criteria in a desire to gain more business from the investment banks that issued the securities.

"It could be structured by cows and we would rate it," according to an excerpt from an instant-messaging exchange between two S&P analysts that was cited in the lawsuit.

Under the agreement, S&P acknowledged that its stated mission was to provide "objective, independent" information to the marketplace, and its published policies barred employees from trying to influence analyst opinions based on commercial relationships.

The Managing Director in charge of S&P's Global Collateralized Debt Obligation group slowed the rollout of a new ratings model "pending further measures to deal with such negative results," noting that one investment bank has said the model would result in S&P missing "potential business opportunities," according to the statement of facts agreed to under the settlement.

(Reporting by Aruna Viswanatha in Washington and Karen Freifeld in New York, additional reporting by Jonathan Stempel in New York and Karen Pierog in Chicago; Editing by Kirti Pandey and Bernadette Baum)

By Aruna Viswanatha and Karen Freifeld

Stocks treated in this article : McGraw Hill Financial Inc, Moody's Corporation