AUSTIN, Texas — Embattled Texas Attorney General Ken Paxton, who is fighting criminal charges of personally duping wealthy investors before taking office, won a major court victory Friday when a judge dismissed a nearly identical civil case brought against him by the U.S. government.

A federal judge gave the U.S. Securities and Exchange Commission two weeks to try again and refile charges against Paxton that stick, but for now, the Republican has shed one of two cases that have marred his political rise.

Paxton has spent most of his 20 months on the job under felony indictment. He has pleaded not guilty in the criminal case while trying to preserve a high profile nationally, leading lawsuits against the Obama administration over immigration, transgender rights and Syrian refugees.

The collapse of the civil case gives Paxton a long-sought court victory over allegations that he deceived investors in a high-tech startup called Servergy Inc. by not disclosing the company was paying him. He has twice lost his attempts to have the July 2015 criminal indictments against him thrown out and is currently trying again before the state’s highest criminal court.

U.S. District Judge Amos Mazzant, who “conditionally granted” the dismissal of the civil lawsuit barring a second effort by the SEC, said federal regulators lacked enough facts to keep their case moving forward.

Paxton had been accused of raising $840,000 in 2011 by betraying friends and using high-pressure tactics to secure investors. At the time, Paxton was a state legislator from suburban Dallas, and one investor he allegedly misled was a fellow Republican lawmaker.

“Paxton did not have a legal obligation to disclose his financial arrangement,” Mazzant wrote.

Texas’ top prosecutor will now hope for a similar outcome at the state’s highest criminal court. The Texas Court of Criminal Appeals, which earlier this year dismissed a felony abuse-of-power case against former Gov. Rick Perry, has not yet decided whether it will hear Paxton’s appeal.

Special prosecutors over the criminal case against Paxton said the federal ruling will have no bearing on their case.

“We’re confident that today’s ruling will have no meaningful effect on our ability to prosecute Mr. Paxton,” special prosecutor Brian Wice said.

The felony securities fraud charges against Paxton carry a possible sentence of 5 to 99 years in prison. He is likely to stand trial in 2017 unless the charges are thrown out.

Mazzant said accusations by the SEC that Paxton misled investors about Servergy were flawed. In one example, federal regulators claimed that Paxton told an investor the offering price would double before he returned from vacation, but Mazzant said the SEC never alleged that statement was misleading.

But at the heart of Mazzant’s decision was his assertion that the SEC failed to prove that Paxton had a “fiduciary relationship” with the investors he recruited, and therefore had no duty to tell them that he was being paid by Servergy in the form of 100,000 shares.

Paxton hasn’t been the only state attorney general in legal trouble. In August, Pennsylvania Attorney General Kathleen Kane resigned after the Democrat was convicted of perjury and conspiracy in a case surrounding leaked grand jury information.

Follow Paul J. Weber on Twitter: