Dan Graves, a mental health aide in San Jose, California, had mixed feelings when he heard that ITT Educational Services had filed for bankruptcy in mid-September.

As a former employee who had blown the whistle on ITT, an operator of some 140 for-profit schools, Graves was happy that the government had finally taken action to protect students from the company’s aggressive sales tactics, which lured them into debilitating debt and provided little in the way of an education.

Still, he wondered what had taken the government so long. After all, it has been 17 years since Graves and another former ITT employee brought a suit alleging that the company had systematically violated the law governing compensation of sales representatives.

The two former employees shared extensive documentation with a half-dozen federal prosecutors and regulators. These officials expressed keen interest, Graves said, and estimated that the government could recover $400 million in damages from the case. But by 2004, the lawsuit was dead and Graves’ effort to provide the government with damning evidence had come to naught.

“We thought we had a pretty good case,” Graves, 65, said in a recent interview. “They were abusing that system for years and ripping off the government for billions of dollars and we brought that to light.”

ITT could not be reached for comment. An email to its spokeswoman came back saying she had left the company.

Now that ITT is in bankruptcy, Graves’ whistle-blower experience is instructive. It spotlights a costly regulatory failure that allowed ITT to stay in business far longer than it otherwise might have, Graves said. And that meant taxpayers were liable for billions of dollars in defaulted loans made over the period while thousands of students were left with a mountain of undischargeable debt and few job prospects.

“It was an institutional failure by the government and a complete abdication of responsibility to enforce the Higher Education Act,” said Scott D. Levy, the Houston-based lawyer who represented Graves in his suit.

Not everybody was a loser in this tale, of course. Going through ITT’s financial filings between 2000 and 2016, I found that the company generated over $12 billion in revenue, roughly 70 percent of it in government-backed student aid.

ITT’s top five executives received princely compensation over the period — $117 million in total, regulatory records show. Lobbyists for ITT Educational Services also benefited. The company has spent almost $1 million on lobbying since 1998, according to the Center for Responsive Politics.

When Graves and his colleague filed their suit in 1999, improper recruiter compensation among for-profit schools was a hot topic. Paying commissions to sales representatives, after all, encouraged the schools to bring in students whether or not they were likely to succeed.

Students were paying $35,000 for their ITT educations, court records show. And the company was paying incentives to recruiters, a practice that was supposed to bar it from retaining payments made by the government in connection with financial aid under the Higher Education Act of 1965.

In late 2000, the Education Department cited compensation violations at Computer Learning Centers, a for-profit education company, and demanded $187 million from the company, which filed for bankruptcy in early 2001. (Levy filed a successful whistle-blower suit against Computer Learning Centers.)

The Education Department came under fire after the Computer Learning Centers collapse. “The blowback from Wall Street was huge,” Levy recalled. “The Education Department got all the blame for putting the school out of business.”

Beginning in 2001, with George W. Bush in the White House and Republicans ruling the House of Representatives, the winds were shifting in favor of for-profit colleges. In late May, the complaint was unsealed and details about the incentive compensation practices became public. By this time, ITT had hired the powerful Washington law firm of Gibson, Dunn & Crutcher to represent it.

The day the case was unsealed, Rep. Johnny Isakson, a Georgia Republican, introduced legislation to change the federal statute on incentive compensation at schools. The bill still barred the granting of bonuses in return for enrollments, but it contained a loophole that would allow recruiters to receive salaried pay that reflected their productivity.

For-profit colleges gave full-throated support for the bill. On June 20, 2001, Omer E. Waddles, an ITT executive vice president who soon after became its president, testified before the House, arguing that the current law prevented for-profit schools from hiring and retaining personnel. It also meant that owners and managers of for-profit colleges could not “participate in the financial successes of their schools,” Waddles said.

The bill passed in the House on Oct. 10, 2001, but died in the Senate.

Around the same time, top Education Department officials began softening their stance on incentive compensation. And in the fall of 2002, department officials loosened the restrictions written into the law.

In another action that seemed to protect the schools from liability, William D. Hansen, then the deputy secretary of education, published guidance changing the way the government should measure damages resulting from violations of the incentive rules.

“I have concluded that the preferable approach is to view a violation of the incentive compensation prohibition as not resulting in monetary loss to the department,” Hansen wrote in an October 2002 letter to the head of federal student aid at the time. This was a major change; the Education Department had previously calculated damages resulting from a violation as the total amount of student aid provided to each improperly recruited student.

Hansen left the Education Department in 2003 for the private sector. Now chief executive of USA Funds, a provider of student financial aid, Hansen was until recently on the boards of Argosy University and South University, two for-profit colleges owned by the beleaguered Education Management Corp.

Through a spokesman, Hansen declined to comment on the guidance, which was formally rescinded only in 2015.

The ill-fated ITT case seemed to get a boost in December 2002 when the Justice Department filed a statement of interest with the court. In it, Justice lawyers estimated that ITT’s compensation practices had resulted in a direct loss to the government of $400 million in defaulted student loans. But the district court dismissed the case the following year.

In early 2004, court documents show, the Justice Department began a criminal investigation into ITT colleges in eight states using at least some of Graves’ materials. In an application for a search warrant, a special investigator said he had probable cause to believe crimes including student financial aid fraud, money laundering and racketeering had occurred at ITT “since at least 1993.”

That investigation also went nowhere.

Finally, in late 2004, Levy lost his appeal of the dismissal of the ITT case. The 5th U.S. Circuit Court of Appeals sided with the lower court ruling that the prohibition against incentive pay was an unimportant technical requirement. The Supreme Court declined to hear the case, putting an end to it.

Ten years later, federal and state regulators accused ITT of misleading students about the quality of its educational programs. The Consumer Financial Protection Bureau also sued the company, contending it was a predatory student lender.

The final blow came this year when the federal government began restricting financial aid to new students. ITT’s bankruptcy filing affected about 35,000 current students.

Graves said he was frustrated by the outcome of his case. His lawyer, Levy, also has questions about what happened to it. Hoping to get answers, he recently filed an open records request to the departments of Justice and Education asking for internal documents related to the suit. He has not received any yet.