US Congressman Rep. Virgil Goode (R-VA) speaks near the Washington Monument during a rally sponsored by the Minutemen Project in 2007. (Chip Somodevilla/GETTY IMAGES)

Virgil Goode spent 24 years in the Virginia Senate and 12 in Congress — first as a Democrat, then an independent and finally a Republican.

He is now running for president on the Constitution Party line. His campaign has made it onto ballots in 17 states, according to Ballot Access News, and he is busy gathering signatures to add Virginia to the roster.

If Goode succeeds, he could become a spoiler in Virginia’s neck-and-neck race between President Obama and Mitt Romney. Some Republicans fear that Goode, a lawyer who was born and raised in Franklin County, would shave votes from the former Massachusetts governor.

“If you want to see Barack Obama reelected president of the United States, do whatever you can for Virgil Goode,” said Virginia Republican strategist Chris LaCivita.

But Goode dismissed the suggestion that he would hurt the presumptive Republican nominee, even though the Constitution Party candidate is running on a conservative platform that emphasizes stanching both legal and illegal immigration.

“I think we’re going to take votes from both Romney and Obama,” said Goode, who opposes abortion, foreign aid and the North American Free Trade Agreement. “Gathering petitions, I can’t tell you the number of persons who told me they don’t like either one.”

Both major parties have put a heavy emphasis on Virginia, calculating that the candidate who wins the state could well claim the presidency. Romney campaigned in the commonwealth last month, while Obama made a swing across the state Friday and Saturday.

Nationally, Goode had the support of less than half of 1 percent of registered voters in a Gallup poll released this month that included Obama, Romney, Goode, Libertarian Party candidate Gary Johnson and Green Party candidate Jill Stein. But because of his long history as a Virginia officeholder, it’s possible he could do better in his home state.

A survey of Virginia released this month by Public Policy Polling — which uses automated phone calls rather than live interviews — showed Goode earning 9 percent of the vote in a three-way matchup. A PPP survey in May gave Goode 5 percent. (Pollsters rarely include third-party candidates at this stage of the campaign because it’s unclear who will be on the ballot.)

Even if Goode received just 2 or 3 percent of the vote in the general election, he could tip the scales in Virginia, where most surveys show Obama and Romney a few percentage points apart. He might be especially strong in his former congressional seat, which includes Charlottesville and much of the southern part of the state.

Goode has remained popular in the Franklin region even as he morphed from being a conservative Democrat who frequently clashed with the Clinton administration to a conservative Republican. He won reelection to Congress by wide margins until 2008, when Democrat Tom Perriello defeated him by 727 votes. (Perriello lost the seat in 2010 to Republican Robert Hurt.)

“If he gets on the ballot, certainly it’s going to be a consideration for us in the 5th District, because Virgil has always been a strong presence in the 5th for many years,” said state Sen. Bill Stanley (Franklin), who chairs the district’s Republican committee. “There are many people in the 5th who think the world of Virgil, as do I.”

But Stanley said that he will be voting for Romney and that it would be crucial for local Republican leaders to convince residents that a vote for Goode would hurt the GOP candidate.

Obama won the state in 2008 — the first Democrat in more than four decades to do so — over Sen. John McCain (R-Ariz.) by 6 percentage points. The other four candidates on the ballot, plus write-ins, combined to earn 1 percent of the vote. Two third-party candidates combined to get less than 1 percent in the 2004 presidential contest in Virginia, while Green Party nominee Ralph Nader took 2 percent in 2000.

Getting on the ballot in Virginia is tougher than in many other states — former House speaker Newt Gingrich (Ga.) and Texas Gov. Rick Perry learned that the hard way this year when they failed to qualify for the state’s Republican primary.

To get on the ballot, Goode must submit the signatures of at least 10,000 qualified Virginia voters, including a minimum of 400 from each of the state’s 11 congressional districts, by noon Aug. 24. Those signatures would have to survive any legal challenges that state Republicans might choose to mount.

Goode said he has collected more than 10,000 signatures, with more than 400 from each district, but was working to build a “cushion” because he knows that some will be thrown out.

“I have spent more time getting signatures in Virginia than any other state,” he said. “We’re optimistic.”