The Justice Department is preparing to file a civil lawsuit against the ratings agency Standard & Poor’s that will allege the company gave its seal of approval to toxic investments at the heart of the financial crisis, according to the company and people briefed on the case.

The lawsuit would mark the government’s first federal case against one of the country’s big ratings firms, which have been blamed for playing a major role in causing the meltdown on Wall Street. The Justice Department has faced years of criticism from watchdog groups and some on Capitol Hill who have questioned why it has been slow to pursue those responsible for the crisis.

The department has told S&P it intends to focus on the firm’s grading of certain mortgage bonds from 2007, according to the company.

These ratings have drawn scrutiny because agencies issued top grades to securities tied to shoddy residential mortgages, making them appear safe for investors. When the housing bubble burst and homeowners began defaulting on their loans, these financial products became worthless. The resulting losses on Wall Street nearly took down the entire financial system.

The Justice Department and S&P attempted to reach a settlement, but talks broke down, according to two people familiar with the matter. A lawsuit may be filed as soon as this week, and several state attorneys general are expected to join the case, the people said.

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

Another person close to the case said the lawsuit is likely to be filed in Los Angeles, one of the centers of the housing bust.

These people spoke on the condition of anonymity because the lawsuit has not yet been filed.

Without a copy of the lawsuit, it is hard to say what kind of case the Justice Department has built. The agency has chosen to file a civil suit, rather than a criminal case that could potentially put executives behind bars.

For some critics of the department, a civil case is not good enough.

“It seems the Justice Department is trying to sue the country’s way out of the fiscal crisis instead of bringing cases that might have a real deterrent effect,” Sen. Charles E. Grassley (R-Iowa), a frequent critic of how the department has handled Wall Street prosecutions, said in a statement. “Most civil suits are simply the cost of doing business and aren’t enough. Unfortunately, this appears to be another instance of the civil case-only, ‘too big to jail’ mentality at the Justice Department.”

The Justice Department declined to comment on the news, which was reported by the Wall Street Journal on Monday afternoon.

S&P, the country’s biggest ratings agency, said in a statement that the government’s case is “without factual or legal merit.”

“It would disregard the central facts that S&P reviewed the same subprime mortgage data as the rest of the market,” the statement said.

S&P’s response appeared to outline the company’s central defense — that it was not the only ratings agency missing the picture and that it downgraded a number of securities ahead of the crisis.

For instance, the company said it downgraded 400 securities tied to residential mortgages as early as 2006, “more than in any prior year in history.”

“S&P deeply regrets that our [collateralized debt obligations] ratings failed to fully anticipate the rapidly deteriorating conditions in the U.S. mortgage market during that tumultuous time,” the statement said. “However, we did take extensive ratings actions in 2007 — ahead of other agencies.”

The ratings business is dominated by three big players: S&P, Moody’s and Fitch. McGraw-Hill, S&P’s parent company, saw its stock sink nearly 14 percent Monday. Moody’s stock dropped more than 10 percent.

It is not clear why S&P is the only firm to be singled out by the Justice Department. A staff report by the Senate’s Permanent Subcommittee on Investigations singled out Moody’s for profiting immensely from its business rating mortgage securities, even though the company’s methods turned out to be flawed.

Moody’s declined to comment for this story. Fitch said it does not expect any lawsuits from the government soon.

“We are unable to comment on the S&P matter as it does not involve us, other than to say we have no reason to believe Fitch is a target of any such action,” said Fitch spokesman Daniel Noonan.

Critics have said the country’s big ratings agencies had a conflict of interest because they were being paid by the very companies whose products they were rating. This created incentives for the agencies to inflate their ratings, according to the final report by the subcommittee on investigations.

Separately, the Financial Crisis Inquiry Commission concluded in 2011 that the crisis “could not have happened without the ratings agencies.”

S&P insists that it was not motivated by greed when it rated the complex products being churned out by the country’s investment banks. The company was also not the only one that missed signs of a housing bubble about to burst.

“With 20/20 hindsight, [S&P’s ratings downgrades] proved insufficient,” S&P said in its statement, “but they demonstrate that DOJ would be wrong in contending that S&P ratings were motivated by commercial consideration and not issued in good faith.”

Sari Horwitz contributed to this report.