J.P. Morgan Chase said Friday it will pay $27 million to settle a class-action lawsuit that accused the bank of overcharging members of the military for their mortgages and prompted a federal investigation, a congressional hearing as well as public outrage.

In the suit, Marine Corps Capt. Jonathon Rowles charged that the bank refused to lower the interest rate on his mortgage, as required under a federal law, after he was activated for duty. When Rowles refused to pay the higher rate, the bank called his home up to three times a day and threatened to foreclose, according to the suit, which was filed in July.

The Servicemembers Civil Relief Act (SCRA) prohibits lenders from charging active-duty members of the military more than 6 percent interest on their mortgages. It also prevents banks from foreclosing on their homes during service and for nine months afterward.

Under the terms of the settlement, the bank will give $12 million to the estimated 6,000 service members covered by the suit. It will also set up a $15 million fund for additional individual damages, to be disbursed by a third party. The firm said it has already issued $6 million to service members who were overcharged. A judge is slated to issue preliminary approval to the settlement in late May.

“I don’t know if you can measure what’s enough in terms of giving those families back what they’ve gone through,” said Peter Gaytan, executive director of the American Legion. “We hope this is a lesson to Chase and other lenders to put military families first.”

Over the past year, Chase and other lenders have faced a wave of allegations involving SCRA violations. Wells Fargo recently announced a $10 million settlement in a class-action suit alleging excessive fees for mortgage refinances. Saxon Mortgage Services, a division of Morgan Stanley, settled last month with Army National Guard Sgt. James Hurley, who said his home was foreclosed on while he was in Iraq.

And during a hearing before the House Veterans’ Affairs Committee early this year, Chase executives said they wrongfully foreclosed on 18 service members. The bank said it has found other potential cases since then.

“We hold ourselves accountable and responsible for these mistakes, and fixing them is just the beginning of a new way forward,” Frank Bisignano, Chase’s chief administrative officer, said Friday in a statement.

The bank quickly began making amends after the hearing. It has lowered its interest rate to 4 percent for members of the military on active duty and for a year afterward, and it expanded its loan modification program for those who have served since Sept. 11, 2001. Chase also pledged to forgive all mortgage debt for service members who were foreclosed on and created hiring and job training programs for members of the military.

The bank said Friday that Rowles would join its veterans advisory council. “I think they’ve gone above and beyond the call of duty on this,” said Richard A. Harpootlian, an attorney representing Rowles in the class-action suit.

But John Odom, a retired colonel in the Air Force who worked on the Hurley case, said that he lacked confidence that the bank will institute long-term changes, though he commended the terms of the settlement.

“They realized that the tsunami was headed right for them,” Odom said. “I do not think that to this day the mortgage servicing industry understands the SCRA and all of the protections.”

Chase still faces several challenges on Capitol Hill and from federal regulators. The Justice Department has opened an investigation into the bank, along with Saxon Mortgage. A department spokeswoman said Friday that the case is ongoing.

Meanwhile, Sen. Sheldon Whitehouse (D-R.I.) has introduced a bill that would double the criminal and civil penalties for foreclosing on active-duty service members or for other violations of the SCRA. It would also extend service members’ grace period from foreclosure from nine months to 24. Rep. Tim Walz (D-Minn.) introduced a similar proposal in the House last week. Both bills await votes in committee.

“I hope this settlement will help rectify the harm that Chase caused to military families, and I urge other lenders to own up to their mistakes,” Whitehouse said in an e-mail Friday. “But this settlement does not wipe the slate clean, and we should still take action to make sure these mistakes are not repeated.”