In the latest blow to Wells Fargo’s efforts to rebuild its reputation after months of turmoil, the bank on Tuesday received a failing score on community lending from its federal regulator.

Wells Fargo was given a “needs to improve” rating on its latest evaluation under the Community Reinvestment Act, a 1977 law intended to promote lending in low-income neighborhoods.

Drawing on both public material and confidential information obtained during its review, the bank’s regulator, the Office of the Comptroller of the Currency, said it had uncovered “an extensive and pervasive pattern and practice of discriminatory and illegal credit practices across multiple lines of business within the bank, resulting in significant harm to large numbers of consumers.”

Wells Fargo has been under fire since its admission in September that over the course of several years, employees trying to meet aggressive sales quotas opened as many two million fraudulent accounts.

The comptroller’s office criticized that conduct in its report, but it also pointed to at least nine other examples of what it called “egregious” violations by Wells Fargo that harmed borrowers.

In particular, the agency said it had reason to believe that from 2004 to 2008, Wells Fargo’s mortgage brokers discriminated against black and Hispanic borrowers, charging them higher fees than white customers paid. In 2012, the bank agreed to pay $175 million to settle the accusations without admitting any wrongdoing. The agency also cited multiple settlements Wells Fargo had paid for violating rules on lending to members of the military.

The regulator praised Wells Fargo for most of its other lending and investment activities, including the bank’s volume, geographic distribution and service delivery. On those measures, Wells Fargo received high scores — but the bank’s misdeeds were so glaring, the agency decided, that they overshadowed its achievements.

Wells Fargo said it was disappointed by the rating reduction, which means it will need to clear extra regulatory hurdles to open new branches or otherwise expand its retail banking business. The low mark also often brings scrutiny from regulators and lawmakers.

“We are committed to addressing the O.C.C.’s concerns,” Timothy J. Sloan, Wells Fargo’s chief executive, said in a statement. “Restoring trust in Wells Fargo and building a better bank for our customers and our communities is our top priority.”

Wells Fargo’s board is preparing to release a report next month on its investigation into the bank’s sales scandal. Under pressure to hit aggressive sales goals, thousands of employees created unauthorized bank and credit card accounts in the names of real customers.

Some 5,300 rank-and-file workers, and several top managers, were fired in connection with the scandal, and the bank’s longtime chief executive, John G. Stumpf, retired under pressure soon after it was revealed.

The bank paid $185 million in September to settle charges brought by the Los Angeles city attorney and by federal regulators, including the Office of the Comptroller of the Currency, but several criminal investigations, including an inquiry by the Justice Department, are continuing.