SEATTLE (AP) — Providence health care system is refunding nearly $21 million in medical bills paid by low-income residents of Washington — and it’s erasing $137 million more in outstanding debt for tens of thousands of others — to settle the state’s allegations that it overcharged those patients and then used aggressive collection tactics when they failed to pay.

The announcement Thursday came just weeks before Attorney General Bob Ferguson’s case was set for trial against Providence Health and Services, which operates 14 hospitals in Washington under the Providence, Swedish and Kadlec names.

The state argued that the medical system’s practices violated the state’s charity care law, which requires hospitals to notify patients about the availability of financial aid and to screen them to see if they’re eligible for discounts before trying to collect payment.

“Hospitals — especially nonprofits like Providence — get tax breaks and other benefits with the expectation that they are helping everyone have access to affordable health care,” Ferguson said at a news conference. “When they don’t, they’re taking advantage of the system to their benefit.”

Providence has already erased about $125 million in medical debt following the state’s lawsuit two years ago, Ferguson said.

In a statement posted to Providence’s website, the organization said it was simplifying how it provides information about financial aid to patients and making the application process clearer.

“Charity care and financial assistance are vital resources for patients who cannot afford health care,” said Providence Chief Financial Officer Greg Hoffman. “Providence is committed to providing support to those who need it most, and we will continually evaluate our efforts and make sure they fully meet the needs of those we serve.”

Under the settlement, Providence will also pay $4.5 million to the attorney general’s office for legal fees and the costs of enforcing the charity care law.

The state is still pursuing related claims against two debt-collection firms Providence used.

Sports News