Washington: The Trump administration moved on Wednesday to end its legal fight to overhaul a popular student loan forgiveness programme.

The Department of Justice appealed after federal judges ruled in June in favour of advocates who said the Public Service Loan Forgiveness programme risked becoming a tool for political retribution. But it dropped two appeals on Wednesday in single-sentence joint agreements, which stipulated that each side would pay its own fees.

Federal officials provided no explanation, but advocates praised the ruling.

"The Trump administration's attempt to weaponise public service loan forgiveness against organisations it disagrees with was anti-democratic and unlawful from the start," Dan Zibel, an attorney for the group Student Defense, said in a written statement. "This is a significant victory for millions of Americans who have dedicated their careers to public service."

The PSLF programme was designed to make jobs in government, public schools, fire and police departments, public hospitals, and nonprofits more attractive by forgiving loans after qualified employees make a decade of payments.

But last fall, President Donald Trump's administration wrote a new rule that lets Education Secretary Linda McMahon kick employers out of the programme if she decides their work has a "substantial illegal purpose".

The vaguely phrased rule was targeted at employers who support undocumented immigrants or transgender youth, potentially affecting borrowers who worked at schools, public hospitals and legal-aid groups.

The overhaul amounted to a major reworking of a programme that has cancelled loans for more than one million (10 lakh) Americans.

But just before it was set to take effect in July, US District Judge Myong Joun in Massachusetts vacated the US Department of Education's changes, saying they overstepped the agency's power and threatened to violate First Amendment protections for free speech. The ruling came in response to a pair of lawsuits filed by more than 20 states along with a coalition of nonprofit groups and cities.

On the same day, District Judge Amir Ali in Washington issued a similar ruling in a case brought by nonprofit organisations.