"Moody's failed to adhere to its own credit-rating standards and fell short on its pledge of transparency in the run-up to the Great Recession," Principal Deputy Associate Attorney General Bill Baer said in the statement.

The credit rating agency reached the deal with the Justice Department, 21 states and the District of Columbia, resolving allegations that the firm contributed to the worst financial crisis since the Great Depression, the department said in a statement.

Moody's Corp has agreed to pay nearly $864 million to settle with U.S. federal and state authorities over its ratings of risky mortgage securities in the run-up to the 2008 financial crisis, the U.S. Department of Justice said on Friday.

S&P Global's Standard & Poor's entered into a similar accord in 2015 paying out $1.375 billion. Standard and Poor's is the world's largest ratings firm, followed by Moody's.

Moody's said it would pay a $437.5 million penalty to the Justice Department, and the remaining $426.3 million would be split among the states and Washington, D.C.

As part of its settlement, Moody's also agreed to measures designed to ensure the integrity of credit ratings going forward, including keeping analytic employees out of commercial-related discussions.

The rating agency's chief executive also must certify compliance with the measures for at least five years.

Moody's said that it stands behind the integrity of its ratings and noted that the settlement contains no finding of a violation of law or admission of liability.

Moody's said it already has implemented some of the compliance measures in the agreement.

Moody's shares closed at $96.96 on Friday. The stock plummeted more than 5 percent on Oct. 21, the day it disclosed the Justice Department had notified the firm it was planning to sue over the ratings.

Moody's settlement on Friday resolved the Justice Department probe without a federal lawsuit. In the Standard & Poor's case, resolution was reached after the U.S. filed a $5 billion fraud suit.

Connecticut, whose attorney general helped lead negotiations, filed a lawsuit against Moody's in 2010. Mississippi and South Carolina later sued, and other states had potential claims.

Connecticut's lawsuit claimed that Moody's ratings were influenced by its desire for fees, despite claims of independence and objectivity. It also accused Moody's of knowingly inflating ratings on toxic mortgage securities.

Moody's ratings were "directly influenced by the demands of the powerful investment banking clients who issued the securities and paid Moody's to rate them," Connecticut Attorney General George Jepsen said in a statement on Friday.