The American Federation of Teachers, one of the country’s biggest teachers unions, sued Education Secretary Betsy DeVos on Thursday alleging gross mismanagement of a loan forgiveness program for public servants.

“This program was not supposed to be negotiable or debatable. It is a right under law. It shouldn’t be a crapshoot, but under Betsy DeVos, that is exactly what it’s become,” American Federation of Teachers President Randi Weingarten said on a call with reporters.

The Public Service Loan Forgiveness program has become a lightning rod for controversy. It encourages federal student loan borrowers to work in the public sector with the promise of canceling the balance of their debt after 10 years of on-time payments. But participants say the companies the Education Department uses to service loans have led borrowers to believe they were making qualifying payments when they were not, processed payments incorrectly or botched paperwork.

Those mistakes could lead to additional years of payments or rejected applications. The allegations are at the heart of the case filed by the teachers union and a spate of lawsuits against Navient, FedLoan Servicing and other servicing companies. The teachers union previously sued Navient over the loan forgiveness program. The company and other servicers facing litigation in connection with the program have denied wrongdoing.

Thursday’s lawsuit, filed in the U.S. District Court for the District of Columbia, claims the Education Department ignored borrower complaints about loan servicers providing inaccurate information and making administrative mistakes. The alleged mismanagement of the loan forgiveness program violates federal law and the Constitution, according to the lawsuit.

Several public school teachers, a federal worker and a nonprofit employee who have been denied forgiveness joined the union in taking legal action. The workers are seeking cancellation of their loans, while the union is asking the court to order the Education Department to create a robust appeals process and a system to identify and account for servicing errors.

Education Department spokeswoman Liz Hill said the agency “doesn’t comment on pending litigation, but I would point out, that the Department is faithfully administering the complex program Congress passed.”

Lawmakers created the loan forgiveness program in 2007 during President George W. Bush’s administration to entice college graduates to go into teaching, law enforcement and other public service jobs.

The rules are complex. They require borrowers to have loans made directly by the federal government, but until 2010 most federal loans were originated by private lenders. Applicants must also be enrolled in certain repayment plans — primarily those that cap monthly loan payments to a percentage of borrowers’ income. But most of those plans emerged only in recent years.

A recent Government Accountability Office audit said the Education Department never provided a written instruction manual to FedLoan, the company managing the program. The company has had to interpret guidance that was contradictory or poorly explained, according to the audit. Investigators said poor communication between FedLoan and other servicing companies about borrowers’ accounts results in miscounting payments eligible for the program.

Fault lines in the program became evident last year as scores of applications for forgiveness were rejected, which higher education experts said signals confusion about the terms and reflects poor management of the program.

As of March, more than 73,500 federal student loan borrowers had turned in nearly 86,006 applications to have their loans canceled under Public Service Loan Forgiveness. Only 864 of those applications have been approved, and 518 people have received debt forgiveness, to the tune of $30 million in total, according to the Education Department.

Because there are so many requirements, some of which were fully fleshed out only in later years, few people could reasonably be expected to qualify for forgiveness at this point. Nearly three-quarters of processed applications were denied because borrowers did not meet at least one program requirement.

Many people were turned away for having the wrong type of federal loan: those originated by private lenders through the now-defunct Federal Family Education Loan Program. Those loans can be consolidated into the Direct Loan program, but only payments made after consolidation qualify for forgiveness.

Kelly Finlaw, one of the plaintiffs in the union lawsuit, said she learned she had the wrong type of federal loan only after 10 years of making payments toward forgiveness. The New York public school teacher said she then consolidated her loans, but that meant all of her previous payments counted for nothing.

“I have $88,000 of debt, and I am back at the bottom,” Finlaw said on a call with reporters. “I’ve been told different things at different times. I’ve spent so much time trying to make this right . . . and I’ve come to the end of the line.”

Other people rejected by the Education Department were enrolled in the wrong repayment plan or had not made enough on-time payments.

Six years into paying down her loans, Gloria Nolan, another plaintiff in the union lawsuit, said she learned that her repayment plan did not qualify for the forgiveness program. Nolan, who works at an education nonprofit in Missouri, switched to an eligible plan in 2014. When Congress created a temporary relief program for public servants who were in the wrong repayment plan, Nolan applied to have those six years of payments count toward loan forgiveness. Her application was rejected.

“When I asked why I was denied, I heard all kinds of reasons,” Nolan said. “I was told I pulled down the wrong application from the official website . . . one of my forms had the wrong date . . . they claimed they couldn’t read the forms. All told, I turned in 10 different applications. Denied. Denied. Denied was all I heard.”

Jason Delisle, a resident fellow at the conservative American Enterprise Institute think tank, argues that the lawsuits over loan forgiveness programs often reveal that borrowers were informed but did not meet the terms or ignored advice.

“There just doesn’t seem to be any evidence yet that the servicers and Department of Education have not implemented the program that Congress designed,” Delisle said. “These cases all flow from the belief that all denials are evidence of some sinister plot, without examining the case-by-case evidence.”