The Massachusetts attorney general sued the Pennsylvania Higher Education Assistance Agency on Wednesday, alleging that PHEAA botched the management of a teacher grant program and a federal program that forgives student loans after 10 years of public service, causing graduates to lose benefits and go deeper into debt.

The U.S. Department of Education hired a PHEAA unit to manage the Public Service Loan Forgiveness and Teacher Education Assistance for College and Higher Education Grant programs. The teacher program provides grants of up to $4,000 a year for teaching certain subjects for four years in low-income schools.

The lawsuit alleges that PHEAA failed to process applications for the programs quickly enough to allow borrowers to make qualifying payments on the loans. In the case of the teacher program, grants were converted into loans because of the delays, the lawsuit says.

Separately, the lawsuit alleges that PHEAA "overcharged hundreds of Massachusetts borrowers and collected tens of thousands of dollars in payments that were not due" because of a defect in the company's service system. Nationwide, the overcharges affected "tens of thousands" of borrowers, the suit says.

"PHEAA does not agree with the allegations," spokesman Keith New said in an email. "However, PHEAA remains committed to appropriately resolving any outstanding borrower issues while following the U.S. Department of Education's policies, procedures, and regulations as mandated by the agency's federal contracts."

The lawsuit, filed in Massachusetts Superior Court, asks for restitution to borrowers, civil penalties, attorneys' fees, and an injunction against the unfair practices outlined in the complaint.

PHEAA was servicing $291 billion in student loans as of March 31, according to a financial statement on its website.