WASHINGTON (AP) — President Donald Trump’s lawsuit against the Internal Revenue Service over his leaked tax returns was filed for an “improper purpose,” a judge said Monday as she referred one of his lawyers for potential disciplinary action and characterized the $10 billion complaint as an exercise in self-dealing.

U.S. District Judge Kathleen Williams accused Trump and his lawyers in a scathing ruling of having manipulated the court system when he sued a federal agency under his control, bypassing a requirement that parties in a lawsuit must have adverse interests. The lawsuit ended in a settlement that granted the president immunity from tax audits and established a $1.776 billion fund to compensate Trump allies who believe they have been unjustly persecuted.