RICHMOND — A Richmond Circuit Court judge on Wednesday ordered independent candidate Shaun Brown removed from the ballot in Virginia’s 2nd District congressional race, finding that her qualifying petition was tainted by “forgery” and “out and out fraud.”

Many of those signatures were gathered by staffers working for the incumbent Republican, Scott Taylor, who is seeking a second term. Five current or former staffers for the congressman declined to answer questions in court, invoking their Fifth Amendment against self-incrimination. A separate criminal probe into the matter is ongoing; a state police investigator attended the civil hearing.

The Democratic Party of Virginia, which brought the civil suit against the State Board of Elections, submitted 41 affidavits from people who said their signatures were forged on petitions to get Brown qualified for the ballot. A handwriting expert testified Wednesday that of 377 signatures collected by Taylor’s staffers, at least 146 appeared to be false.

Brown needed 1,000 signatures to qualify for the ballot; election officials said they had identified 1,193 that could be counted, pending any rulings on forgeries. The 377 collected by Taylor staffers were part of that total.

The Democratic Party had subpoenaed Taylor to appear at the hearing, charging that he wanted Brown on the ballot to siphon away votes from his Democratic challenger, retired Navy officer Elaine Luria.

But Judge Gregory L. Rupe granted a motion to quash Taylor’s subpoena under a state law that shields sitting members of Congress from being compelled to attend civil court proceedings while the U.S. House is in session.

National Democrats have targeted Taylor’s Hampton Roads-area seat as a potential pickup in their effort to regain a majority in the House of Representatives. The party was represented by Marc Elias and Aria Branch of the law firm Perkins Coie; Elias was general counsel for Hillary Clinton’s presidential campaign in 2016.

Brown was the Democratic nominee who was beat badly by Taylor in 2016, but she is now facing federal fraud charges on a matter unrelated to the race and had no party support to run again this time.

She said Wednesday that she would appeal the judge’s ruling, insisting that she knew nothing about efforts by Taylor’s staff and that her own workers had gathered enough valid signatures.

“It’s a sham,” Brown said. “It’s really awful.”

The question of Taylor’s involvement with the petition drive remained murky at Wednesday’s hearing.

Lawyer Jeffrey Breit, arguing for the Democratic Party, said the affidavits signed by Taylor’s staffers could be presumed, under case law, to signify that they were afraid to incriminate themselves by answering certain questions. Several had gathered in the hallway outside the courtroom and left shortly after the judge accepted their affidavits.

Each staffer’s affidavit contained a specific list of questions that they would decline to answer. Some of the staffers invoked the Fifth at the prospect of answering whether Taylor himself directed them to mount the signature-gathering effort.

Luria seized on that in a statement after the judge’s order, saying that Taylor “has dodged responsibility for the criminal actions of his paid staff” and calling on him to “stand up and take responsibility.”

A spokesman for Taylor brushed off the issue.

“Given that the Democrat lawsuit was purely political and has now successfully excluded Shaun Brown, it’s understandable that individuals would exercise their right not to testify today,” Taylor spokesman Scott Weldon said via email. “Our campaign will continue to cooperate with the investigation and make no further comment while it is ongoing.”

The special prosecutor conducting the criminal investigation, Roanoke city Commonwealth’s Attorney Donald Caldwell, did not return a phone call seeking comment on the case. He earlier told the Virginian-Pilot newspaper that he does not expect to complete his probe until after the election.

The signatures scandal, which has unfolded with one local news bulletin after another over the past month, may cost Taylor votes in what’s bound to be a very close election, said Quentin Kidd, political analyst at Christopher Newport University.

After spending a lot of time speaking to community groups around Hampton Roads, Kidd said he’s heard a significant number of Republicans say the whole petition scheme has been “one step too far . . . They’re not happy about it.”

Luria’s base, on the other hand, has been energized. It may not be enough to make the difference in a Republican-leaning district, Kidd said, “but if Taylor does lose, it will be because of a self-inflicted wound.”

Democrats also argued that Brown’s petitions were invalid because they contained three separate addresses for the candidate, none of which was her legal home, as required by state law.

James Ellenson, a lawyer for Brown, argued that federal law does not require a candidate to live in the congressional district they are seeking to represent, only that they live in the state. Questions about Brown’s particular address, he said, were insignificant.

Ellenson also charged Democratic Party officials with discriminating against Brown, who is African American. “They are trying to disenfranchise a black woman,” he said.

After about 3½ hours of testimony and arguments, the judge told the lawyers for the Democrats that “I’m buying almost all of what you are selling.”

Though there was confusion about just how many of the 1,000 signatures needed to qualify for the ballot might be forged, Rupe said that “I am satisfied that there are not enough.”

He also termed the problem with addresses to be a “sophomoric” mistake that disqualified those petitions.

Brown said afterward that she would appeal because “there is no doubt there were enough signatures that we collected.”

The clock is ticking, though. Local election officials are required by law to print the Nov. 6 ballots by Sept. 21.