A top federal official in charge of handling complaints about student loans stepped down on Monday, blasting the Trump administration for protecting predatory lenders at the expense of borrowers.

Seth Frotman, the student loan ombudsman at the Consumer Financial Protection Bureau, said in his resignation letter that millions of borrowers had been harmed by “sweeping changes” at the bureau under Mick Mulvaney, President Trump’s budget director, who became the bureau’s acting director in November. A copy of the letter was obtained by The New York Times.

“You have used the bureau to serve the wishes of the most powerful financial companies in America,” Mr. Frotman wrote to Mr. Mulvaney. “The current leadership of the bureau has abandoned its duty to fairly and robustly enforce the law.”

A spokesman for the consumer bureau did not immediately respond to a request for comment.

Mr. Frotman’s position was mandated by Congress eight years ago, when it created the bureau, to serve as a watchdog over the $1.5 trillion student loan market. The office fields about 23,000 complaints a year, covering problems with lenders, debt collectors and a growing number of companies selling “debt relief” services — a market often plagued with fraud. Mr. Frotman had held the job since 2016.