Lawyers for Texas Attorney General Ken Paxton have asked a state judge to dismiss a felony securities fraud indictment that threatens his political career, arguing in court filings that the grand jury investigation was flawed.

Paxton, 52, a Tea Party Republican, was indicted in July on three felonies. He has pleaded not guilty and his attorneys said in court filings late on Monday that the case against the state’s top lawman should be thrown out.

His supporters have called the investigation into activity that happened before Paxton’s election politically motivated. He drew attention earlier this year when he voiced support for Texas county clerks who refused to issue marriage licenses to gay couples for religious reasons.

Paxton was charged with two counts of securities fraud related to stock sales and compensation from the Texas technology firm Servergy, which has been under investigation for suspected misstatements about orders for its data servers.

He also was charged with illegally acting as a securities agent for a separate firm. The charges were brought in his hometown of McKinney in Collin County north of Dallas. Paxton could be sentenced to up to 99 years in prison if convicted.

His lawyers said a judge who had presided over the case behaved improperly in selecting the grand jury, entered the grand jury room while the panel was in session and leaked secret details of the indictment to his wife.

State District Judge Chris Oldner has recused himself from the case and was replaced by Judge George Gallagher of Fort Worth, which is in Tarrant County.

Paxton’s attorneys said the statute of limitations had run out on the charge of failing to register as a securities agent. The Texas State Securities Board in 2014 found that Paxton was not properly registered as an investment adviser. It reprimanded Paxton and fined him $1,000.

“We have raised a variety of issues that are ripe to be raised at this stage of the proceedings,” attorney Philip Hilder said in a statement.

Brian Wice, one of the special prosecutors in the case, told the Dallas Morning News in a statement that the motions “baseless” and unworthy of comment.

Paxton has said he would not resign but recently said he was stepping away from some official duties to avoid conflicts of interest.

(Reporting by Marice Richter in Dallas; editing by David Bailey and Tom Brown)