The U.S. Justice Department is investigating the rating agency Standard & Poor's over its actions on mortgages leading up to the financial crisis, a source familiar with the matter said on Thursday.

The investigation -- which the source said relates to what S&P analysts wanted to do and what they were told to do instead -- began before the ratings firm, downgraded the long-term U.S. debt to AA-plus from a AAA rating this month.

The probe is being led by the Justice Department's civil division, the source said, declining to be further identified because the investigation is ongoing and not public.

The Securities and Exchange Commission has also been probing S&P, a unit of McGraw-Hill, over its role in the crisis, the source said.

Representatives for the Justice Department and SEC declined to comment.

The confirmation comes after the New York Times reported that the probe, which is centering on whether S&P improperly rated dozens of mortgage securities in the years before the financial crisis that unfolded in 2008.

The department has been asking about instances in which S&P analysts wanted to assign lower ratings to mortgage bonds but may have been overruled by S&P business managers, the newspaper reported.

Ed Sweeney, a spokesman for S&P, said that its core principles had included analytic independence and objectivity and that since 2008 the firm had taken steps to enhance those policies.

S&P has received several requests from different government agencies over the last few years regarding U.S. mortgage-related securities. We have cooperated and will continue to cooperate with these requests, he said.

It was unclear whether the Justice Department investigation involves the other two ratings agencies, Moody's Corp and Fimalac SA's Fitch, which have not downgraded U.S. debt.

The Times said that despite the outcry over the ratings agencies' failures in the financial crisis, investors still rely heavily on ratings from the three main agencies for their purchases of sovereign and corporate debt, as well as other complex financial products.

The Senate's permanent subcommittee on investigations, headed by Democratic Senator Carl Levin, issued a report in April that included scathing criticisms of S&P after holding hearings on the financial crisis.

The hearings held by the Permanent Subcommittee on Investigations and our subsequent report documented reckless actions and significant conflicts of interest on the part of the credit rating agencies that contributed to the financial crisis, Levin told Reuters in a statement.

It is totally appropriate for U.S. law enforcement agencies to review that sad record, he said.

Senator Chuck Grassley, a Republican from Iowa, said he hoped the investigation would focus fresh attention on the inherent conflict of interest in the industry, which is paid by potential borrowers to rate their credit-worthiness.

Maybe a Justice Department investigation will force action on the conflicts of interest problem and accomplish what should have been done a long time ago, Grassley said in a statement.

Additionally, S&P has been under fire from lawmakers, market players and the U.S. Treasury Department since its decision to cut the U.S. credit rating earlier this month. Key committees in Congress may also hold hearings about the downgrade and reforms of the ratings industry.

(Reporting by Jeremy Pelofsky, Andrea Shalal-Esa, Sarah Lynch in Washington and Moira Herbst and David Henry in New York; Editing by Sandra Maler)