A lawyer representing the National Rifle Association in a Virginia lawsuit was removed from the case Thursday by a federal judge for failing to disclose an ethical sanction in Texas.

Judge Liam O’Grady told William Brewer III that had he known about the Texas case, he never would have allowed the attorney to practice in the Eastern District of Virginia.

“These are very serious allegations,” O’Grady said. “They’re findings of bad faith.”

The Virginia lawsuit pits the NRA against an insurance broker, Lockton Cos., that helped the group sell coverage for some criminal and civil legal costs if a person is accused of improperly using a firearm. Lockton, which worked with the NRA for 17 years, stopped selling the insurance in May after New York regulators declared the product illegal and fined the company $7 million.

The NRA sued, saying in a May lawsuit that Lockton gave in to “politically motivated coercion” instead of honoring its contract and cost the group “tens of millions of dollars” in revenue and reputational harm.

Lockton has countersued, arguing that the NRA is to blame.

“The NRA’s own overtly political and inflammatory approach to marketing . . . as well as its provocative public stances, have resulted in a shift in the enforcement priorities of insurance regulators and heightened scrutiny,” the insurance company wrote in a June filing.

Brewer was set to defend the NRA in this case; he is also challenging the New York ruling on First Amendment grounds. Because he is not licensed to practice in Virginia, he was admitted by O’Grady on a temporary basis after signing a form saying he had “not been reprimanded in any court nor has there been any action in any court pertaining to my conduct or fitness as a member of the bar.”

In fact, in 2016 Brewer was ordered by a Texas state judge to pay more than $133,000 for trying to influence potential jurors in a lawsuit there with a telephone poll.

Brewer has fought the sanction, and he told O’Grady he did not consider the judgment final, because his appeal is now before the Texas Supreme Court.

“I think the language is very clear,” O’Grady responded.

It appears O’Grady was alerted to the discrepancy by a reporter from the Trace.

“Obviously I’m disappointed,” Brewer said after the court hearing. “No court has denied me admission, in 37 years.” He said that he is exploring an appeal of the judge’s decision but that in the meantime, his partners will handle the NRA lawsuit.

The NRA said in a statement: “The NRA fully supports Brewer Attorneys and Counselors. Today’s decision has no bearing on our relationship with Mr. Brewer and his firm — or the advocacy being undertaken to protect the legal and regulatory interests of our organization. This decision also has no bearing on the NRA’s claims against Lockton or our ongoing efforts to hold the company responsible for its alleged breach of fiduciary duty.”