A federal judge on Thursday awarded former President Donald Trump and one of his top lawyers nearly $1 million for filing a sprawling lawsuit against Hillary Clinton and other perceived political enemies «that should never have been filed.»

U.S. District Judge Donald M. Middlebrooks said in his 46-page order that Trump, lead attorney Alina Habba and Habba Madaio & Associates were jointly liable for $937,989 in the lawsuit he dismissed in September.

«This case should never have been filed. Its insufficiency as a legal claim was apparent from the start. No reasonable lawyer would have filed it,» Middlebrooks wrote, adding that the lawsuit had «a political purpose.»

The Florida judge then argued why he believed Trump, and not just his lawyers, were guilty.

«Mr. Trump is a prolific and sophisticated litigator who repeatedly goes to court to exact revenge on his political adversaries. He is the mastermind of the strategic abuse of the judicial process, and cannot be seen as a litigator who blindly follows the advice of a lawyer. He knew full well the impact of his actions,» Middlebrooks wrote. «As such, I believe sanctions should be imposed on Mr. Trump and his lead counsel, Ms. Habba.»

NBC News has reached out to Habba and Trump’s spokesperson for comment.

The judge’s order comes 10 months after Trump filed a lawsuit alleging that in 2016, Clinton, who was the Democratic presidential nominee at the time, and the Democratic National Committee, along with others, orchestrated a «malicious conspiracy» aimed at investigating his campaign’s ties to Russia, «destroying his life» and rigging the election in favor of Clinton.

The initial complaint named numerous defendants, including former FBI Director James Comey and Rep. Adam Schiff, D-Calif.

The sanctions issued Thursday were on behalf of 18 defendants who filed a joint motion in October alleging that Trump knowingly filed a «factually unsupported and legally unsupported claim.»

The defendants had previously requested approximately $1 million to cover their attorneys’ fees and costs, Middlebrooks said.

The judge’s order characterized Trump and his lawyers as engaging in an «ongoing pattern of misuse of the courts,» citing a series of lawsuits brought by the former president. Among them were last month’s defamation lawsuit against the Pulitzer Board and repeated lawsuits against New York Attorney General Letitia James, who investigated and ultimately sued Trump for alleged bank, tax and insurance fraud.

Such lawsuits, Middlebrooks said, undermined the rule of law, diverted resources «from those who suffered actual legal harm» and painted judges as partisans.