Editor's note: This story has been updated throughout.

A judge has thrown out the federal civil case accusing Attorney General Ken Paxton of securities fraud, giving him his biggest legal victory yet since the allegations surfaced more than a year ago.

U.S. District Judge Amos L. Mazzant III on Friday granted Paxton's motion to dismiss the lawsuit but gave the U.S. Securities and Exchange Commission 14 days to amend its allegations against the attorney general. Paxton is still fighting similar criminal charges at the state level.

Paxton is accused of misleading investors in a company from before he took office as Texas' top lawyer. One of the central allegations is that he persuaded a group of people to invest in the company, a technology startup known as Severgy, without disclosing that he was receiving a commission.

“This case is not about whether Paxton had a moral obligation to disclose his financial arrangement with Servergy to potential investors,” Mazzant wrote in a 29-page ruling. “This case is also not about whether Paxton had some general obligation to disclose his financial arrangement to his investor group.”

Rather, Mazzant concluded, the case is about whether Paxton had a legal obligation to make a disclosure, and he did not — at least according to the facts put forward by the SEC.

Paxton attorney Matthew Martens said in a statement that the ruling was a "victory for Ken Paxton." In another statement, the attorney general thanked Mazzant for his "thorough review" and expressed gratitude for his "dismissal of the entire case."

Mazzant was skeptical of the SEC's case against Paxton in a hearing last month, at one point suggesting the federal government was trying to fit a "square peg into a round hole." Paxton’s lawyers expressed confidence after the hearing that they would beat the SEC case — and that Mazzant’s treatment of it would spell danger for the state charges.

"Now we turn our attention to Ken's exoneration in the state matter where the prosecutor's burden is even higher," Paxton lawyer Bill Mateja said in a statement, noting the accusations "in the SEC mirror those in the state case."

Paxton’s legal troubles began last summer, when a Collin County grand jury indicted him on criminal charges of securities fraud and failure to register with the state securities board. So far, his lawyers have been unable to get the state case thrown out, and they are currently waiting to see whether Texas’ highest criminal court will agree to review it.

Read more of our related coverage: