Indicted House Speaker Mike Hubbard on Tuesday asked a judge to dismiss ethics charges against him after a campaign consultant said a state prosecutor gave him information about the investigation and he used those details to try to damage Hubbard politically.

Hubbard's defense made the accusation in a motion filed Tuesday night. Political consultant Baron Coleman said in an accompanying affidavit that he had between 50 and 100 conversations with prosecutor Matt Hart about the investigation and grand jury.

Coleman said he used information from Hart to start a "whisper campaign" about the ongoing investigation while he worked for Hubbard's primary election opponent in the 2014 election. He said that included the identities of people testifying before the grand jury and assurances that the investigation would result in Hubbard's indictment.

The surprise filing came shortly after a judge struck a blow to Hubbard's defense by refusing to dismiss the ethics case against the powerful Republican from Auburn.

Hubbard lawyer Lance Bell wrote in the motion that the affidavit shows evidence of "gross misconduct" in the case.

Coleman, who is an attorney, in a statement said he came forward after being approached by law enforcement and speaking with a lawyer about his ethical obligations as a member of the Alabama State Bar to disclose what happened.

"I draw no conclusions about what, if anything, that happened in this case may be unlawful or unethical. Rather, I merely distilled into an affidavit some information for the judge to review and consider," Coleman wrote.

Mike Lewis, communications director for the attorney general's office, said he could not comment on the filing because of a judge's recently issued gag order prohibiting communication with the media.

The filing was a surprise because Coleman and Hubbard had been on the opposite side of campaigns and political issues.

Lee County Circuit Judge Jacob Walker on Tuesday refused to dismiss the case against Hubbard, rejecting Hubbard's claims that the state ethics law was unconstitutional and that he was being subjected to a selective prosecution.

Hubbard faces 23 felony ethics charges accusing him of using his position as speaker, and past position as GOP party chairman, to benefit his clients and businesses by lobbying the governor's office, taking legislative action and soliciting clients and investments from major political players.

Hubbard has maintained his innocence and argued that the transactions were legal.

Hubbard, in seeking to dismiss the case, had argued that he had a free speech right to lobby and speak out for his clients.

"Certainly, the First Amendment doesn't protect such a conflict of interest," Walker wrote in the order.

Walker also rejected Hubbard's claims that he was not subject to the state's ethics law as a political party chairman, a position that is not elected, or paid, by taxpayers.

Hubbard is scheduled to go to trial March 28, but the trial could be delayed if the defense appeals those rulings.