NEW YORK — Goldman Sachs, one of the most powerful investment banks on Wall Street, agreed on Monday to pay $5.06 billion to settle allegations that it sold packages of shoddy mortgages to investors during the period leading up to the financial crisis.

But, similar to other massive settlements reached with large banks over the last few years, no individual bank employee is being held responsible for the alleged bad behavior that led to the settlement.

Instead, the settlement includes a $2.385 billion civil penalty and $1.8 billion for distressed borrowers and communities affected by the housing crisis.

“Today’s settlement is another example of the department’s resolve to hold accountable those whose illegal conduct resulted in the financial crisis of 2008,” Benjamin C. Mizer, head of the Justice Department’s civil division, said in a statement.

This is the fifth settlement reached by a panel President Obama put in place in 2012 to look into the lending practices of the country’s largest financial institutions. The Residential Mortgage-Backed Securities Working Group has already reached historic settlements with  JPMorgan Chase and Bank of America. They agreed to pay $13 billion and $16.6 billion respectively. Citibank settled for $7 billion and Morgan Stanley agreed to pay $3.2 billion.

“This settlement, like those before it, ensures that these critical programs—such as mortgage assistance, principal forgiveness, and code enforcement—will continue to get funded well into the future, and will be paid for by the institutions responsible for the financial crisis,” New York Attorney General Eric Schneiderman, the co-chair of the working group, said in a statement.

Between 2005 and 2007, Goldman Sachs repeatedly discovered problems with the mortgages it was selling to investors but didn’t tell investors, according to a statement of facts agreed to by the bank.

In 2006, for example, a Goldman Sachs employee recommended investors buy shares in Countrywide, the large mortgage company, noting that it was issuing more loans than expected. Another Goldman employee responded to the research report by saying: “If they only knew……”

Goldman had already discovered problems with Countrywide’s loans, but didn’t warn investors, according to the settlement agreement.

In a statement, Goldman Sachs said it was pleased to resolve the issue. “Since the financial crisis, we have taken significant steps to strengthen our culture, reinforce our commitment to our clients, and ensure our governance processes are robust,” the statement said.

But advocacy groups quickly pounced on the deal as too lenient, noting that the $5 billion settlement is dwarfed by Goldman Sach’s recent profits. Also, they note, Goldman Sachs will be be able to deduct some of the cost of the settlement from its taxes. “That is not justice,” said Dennis Kelleher, president and chief executive of Better Markets. “Every single individual at Goldman who received a bonus from this illegal conduct not only keeps the entire bonus, but suffers no penalty at all.”

This story has been updated.