For 2nd Congressional District Rep. Scott Taylor (R), the petition fraud case heard in a Richmond courtroom Wednesday already counts as a major unforced error. It could get even worse.

His staffers are accused of fraudulently gathering signatures to get a spoiler candidate on the ballot as an independent to siphon votes from his Democratic challenger, Elaine Luria.

The background, from The Post’s Gregory Schneider:

Shaun Brown had been [Taylor’s] Democratic opponent in 2016 — and he beat her by 22 points — but she was now under the cloud of a federal fraud investigation and had no party support to run again. So Taylor’s staffers mounted a last-minute push and turned in nearly 600 signatures for Brown, giving her more than the 1,000 needed to qualify.

Taylor initially framed the effort as an attempt to right a wrong. Taylor spokesman Scott Weldon said Taylor’s merry band of volunteer signatures gatherers were correcting a “real injustice” that “had been done against the 2016 2nd District Democrat nominee, Shaun Brown.”

A flimsy excuse to cover a political ploy — splitting an opponent’s vote.

Not exactly sporting. But the story kept building, getting more bizarre by the day.

On Wednesday, Richmond Circuit Court Judge Gregory Rupe ordered Brown’s name not be printed on the November ballot, citing “out and out fraud,” adding that “without a doubt there were instances of fraud, perjury, and forgery.”

That’s bad. But the matter doesn’t end there. A criminal investigation is underway into how the signatures were gathered and whether fraud was committed.

While the results of that probe may not be finalized before the election, Taylor’s reputation has taken a hit, and his campaign has been deeply, if not fundamentally, thrown off message. Taylor is “lying low,” not exactly the thing an incumbent in a “toss-up” race can afford to be doing in September.

Does all this mean Taylor is heading for defeat? Not necessarily. Taylor won handily in 2016, out-polling Donald Trump, who also won the 2nd, by more than 34,000 votes.

Eastern Shore native Ralph Northam won the 2nd in the 2017 gubernatorial race, one reason Democrats believe they can flip the district in November. But that bit of history doesn’t guarantee anything this November.

Taylor had a healthy financial edge over Luria through the end of the second quarter, including an advantage in cash on hand. While Taylor may be lying low these days, his campaign won’t be starved for the funds it needs to blanket the district with ads, banners and bumper stickers.

As bad and bizarre as his campaign’s unforced error with the Brown petitions has been, then, he’s still got a formidable presence and should finish strong.

But the Brown imbroglio did him no favors. It looks shady — with the possibility it may become criminal.

We won’t know whether the Brown case has done Taylor any political damage, though, until we have more polling data. The only polling data we have so far are from April, and those numbers were for a hypothetical match-up between Taylor and Luria.

Taylor led Luria 48 percent to 42 percent.

Needless to say, much has changed in this contest since April. Much has changed since Wednesday afternoon — with the trend looking worse for Taylor as the days tick by.

What’s a wounded campaign to do in order to avoid a wipe-out?

Taylor cannot comment on the specifics of the Brown owing to the ongoing criminal probe. There may be some temptation — and there will certainly be ample Democratic prodding — for Taylor to make some sort of statement.

Don’t hold your breath waiting for it.

Taylor, then, will have to run under a cloud, hoping the 2nd District’s GOP bent will carry him through Election Day.

But even is he wins, his worries will not be over. Roanoke Commonwealth’s Attorney Don Caldwell, the special prosecutor looking into the Brown petitions alongside the Virginia State Police, will not release his findings until after the election.

For Taylor, winning a second term may yet turn out to be the easy part. Keeping the seat may be the real challenge.