Federal authorities ended two investigations into the actions of Goldman Sachs during the financial crisis, handing a quiet victory to the bank after years of public scrutiny.

In a rare statement late Thursday, the Justice Department said there was “not a viable basis to bring a criminal prosecution” against Goldman or its employees after a Congressional committee asked prosecutors to investigate several mortgage deals at the bank. Federal prosecutors are typically loath to acknowledge the closing of a case, doing so publicly in only a handful of instances over the last several years.

The Senate’s Permanent Subcommittee on Investigations had examined troubled mortgage securities that Goldman sold to investors, who later sustained steep losses during the crisis. The subcommittee also suggested prosecutors investigate whether the chief executive of the bank, Lloyd Blankfein, had misled lawmakers during public testimony.

Separately, Goldman Sachs announced early Thursday that the Securities and Exchange Commission had ended an investigation into a $1.3 billion subprime mortgage deal, taking no action. The move was an about-face for the commission, which notified the bank in February that it planned to pursue a civil action.

“We are pleased that this matter is behind us,” a bank spokesman said Thursday.

The moves closed a difficult chapter for the bank, whose missteps became emblematic of Wall Street’s excess. But for all the public criticism of the bank, the only law enforcement case to have surfaced against Goldman was a civil case that the bank settled for $550 million in 2010 over a mortgage investment that investigators said had been intended to collapse.

The announcements were also the latest indication that federal investigations into the financial crisis were petering out as the deadline to file cases approached. While the S.E.C. has brought more than 100 financial crisis-related cases, the agency was looking to take on a big case aimed at punishing Wall Street for its role in the crisis.

After President Obama announced the creation of a special task force in January to investigate the residential mortgage mess, the S.E.C. and other authorities vowed to hold the banks accountable. Wall Street packaged and sold subprime mortgages, including to the government-owned mortgage finance giants Fannie Mae and Freddie Mac, that suffered billions of dollars in losses.

The subcommittee, led by Senator Carl Levin of Michigan, focused on a group of mortgage deals that Goldman had arranged and sold. Mr. Levin further suggested that Mr. Blankfein might have misled lawmakers when testifying about the deals.

But in a statement on Thursday, the Justice Department said it “ultimately concluded that the burden of proof to bring a criminal case could not be met based on the law and facts as they exist at this time.” The agency said it would pursue the case again if new evidence emerged.

The S.E.C.’s inquiry into Goldman involved a package of subprime mortgages in Fremont, Calif., that the bank sold to investors in 2006. The S.E.C. was examining whether Goldman had misled investors into believing that the mortgage securities were a safe bet.

The S.E.C. in February sent the bank a so-called Wells notice, indicating that the agency ’s enforcement team planned to recommend an action against the bank. At the time, Goldman said it would fight to convince regulators that they were mistaken.

On Monday, the bank learned that it was successful. Goldman was “notified by the S.E.C. staff that the investigation into this offering has been completed,” the bank said In a quarterly filing released on Thursday Goldman said the agency’s “staff does not intend to recommend any enforcement action.”

Goldman’s Fremont deal, known as Fremont Home Loan Trust 2006-E, was one piece of a broader investigation into the mortgage-backed securities. Wells Fargo and JPMorgan Chase have also received warnings of potential action by the S.E.C.

“Mortgage products were in many ways ground zero in the financial crisis,” Robert Khuzami, the agency’s enforcement director, said at a news conference for the task force.

The agency, along with other federal regulators and the Justice Department, is also pursuing an array of other cases stemming from the financial crisis. And Goldman is not yet off the hook for its part in the Fremont deal.

Last year, the regulator overseeing Fannie and Freddie filed suits against 17 financial firms that sold the mortgage giants nearly $200 billion in mortgage-backed securities that later soured. In its action against Goldman, the Federal Housing Finance Agency cited the Fremont investment.

Still, the announcement on Thursday is welcome news for Goldman, allowing the bank to avoid another major battle with the S.E.C. over the mortgage crisis. In 2010, Goldman paid $550 million to settle accusations that it sold a mortgage investment that was intended to collapse. The bank, the S.E.C. said, failed to disclose to investors that the hedge fund manager John Paulson had helped create — and bet against — the deal.