When he was running for the Republican presidential nomination last year, Gary Johnson, the former two-term Republican governor of New Mexico, drew ridicule from mainstream party members as he advocated legalized marijuana and a 43 percent cut in military spending.
Now campaigning as the Libertarian Party’s presidential nominee, Mr. Johnson is still only a blip in the polls. But he is on the ballot in every state except Michigan and Oklahoma, enjoys the support of a few small “super PACs” and is trying to tap into the same grass-roots enthusiasm that helped build Representative Ron Paul a big following. And with polls showing the race between President Obama and Mitt Romney to be tight, Mr. Johnson’s once-fellow Republicans are no longer laughing.
Around the country, Republican operatives have been making moves to keep Mr. Johnson from becoming their version of Ralph Nader, the Green Party candidate whose relatively modest support cut into Al Gore’s 2000 vote arguably enough to help hand the decisive states of Ohio and Florida to George W. Bush.
The fear of Mr. Johnson’s tipping the outcome in an important state may explain why an aide to Mr. Romney ran what was effectively a surveillance operation into Mr. Johnson’s efforts over the summer to qualify for the ballot at the Iowa State Fair, providing witnesses to testify in a lawsuit to block him that ultimately fizzled.
Libertarians suspect it is why Republican state officials in Michigan blocked Mr. Johnson from the ballot after he filed proper paperwork three minutes after his filing deadline.
And it is why Republicans in Pennsylvania hired a private detective to investigate his ballot drive in Philadelphia, appearing at the homes of paid canvassers and, in some cases, flashing an F.B.I. badge — he was a retired agent — while asking to review the petitions they gathered at $1 a signature, according to testimony in the case and interviews.
The challenge in Pennsylvania, brought by state Republican Party officials who suspected that Democrats were secretly helping the effort to get Mr. Johnson on the ballot, was shot down in court last week, bringing to 48 the number of states where Mr. Johnson will compete on Nov. 6.
Reince Priebus, the national Republican Party chairman, has called Mr. Johnson a “nonfactor.” And Danny Diaz, a spokesman for the Romney campaign, said that its entire focus was on beating Mr. Obama and that “voters understand the stakes are high, and if they want to change the trajectory of this country, they’ll vote for Romney.”
But Robert Gleason, the Pennsylvania Republican Party chairman, vowing that the state will become far more competitive for Mr. Romney than Democrats realize, said he was not about to give Mr. Johnson an easy opening to play a Nader to Mr. Romney’s Gore in Pennsylvania this year.
“This election will be close — if you remember, Bush lost by only something like 143,000 votes in 2004,” said Mr. Gleason, noting that his party has managed to disqualify tens of thousands of Libertarian signatures. “So we play the game hard here.”
Both sides agree that Mr. Johnson, whose pro-marijuana legalization and antiwar stances may appeal to the youth vote and whose antigovernment, anti-spending proposals may appeal to conservative fiscal hawks — and to supporters of Mr. Paul — has the potential to draw from both Mr. Romney and Mr. Obama.
Aides to Mr. Romney, while playing down his impact on their candidate, say Mr. Johnson is more likely to hurt Mr. Obama in the potentially critical state of Colorado, where a marijuana initiative Mr. Johnson supports is expected to draw young voters to his cause on Election Day.
They have said they are keeping a keener eye on Virgil Goode of Virginia, a conservative Constitution Party candidate who is on the presidential ballot in Virginia and 28 other states.
The Republican efforts to impede Mr. Johnson’s candidacy have drawn charges of spying and coercion from Libertarians and countercharges from Republicans that the party had resorted to fraud while accepting secret help from Democrats.
Democrats and Obama campaign officials deny any such involvement. But Mr. Johnson has been receiving critical help from Roger Stone, a longtime Republican operative once so committed to his party that he has a tattoo of President Richard M. Nixon on his back.
A onetime Nixon and Reagan aide, he said he left his party this year out of frustration with its positions on social issues, spending and domestic surveillance. (Mr. Johnson supports same-sex marriage and abortion rights and opposes government surveillance.)
And Mr. Stone says he has become so frustrated with the party’s attempts to shut down Mr. Johnson, whom he says he is advising at no charge, that he vowed in an e-mail last month, “Republican blood will run in the streets b4 I am done.”
Mr. Johnson credited Mr. Stone — who helped organize for Mr. Bush the so-called Brooks Brothers riot that temporarily shut down the presidential election recount in Miami-Dade in 2000 — with helping him navigate his way through the challenges, and with overall advice.
Mr. Johnson said he had no problem being labeled a potential spoiler in an election that he views as “a debate between Coke and Pepsi.” (He said he viewed himself as Perrier.)
“Take the issue of Medicare,” he said. “Both parties are arguing over who is going to spend more money on Medicare when we should be having a raging debate in this country over how we’re going to cut Medicare.”
He admits he has only limited finances. The Federal Election Commission had denied his request for general election matching funds, ruling that he did not meet its requirements for third-party candidates. And his campaign filings show he had roughly $50,000 in the bank at the end of August, having burned through much of the more than $350,000 or so he raised in small donations that month.
He said that his campaign had found it hard to keep up with the offers of volunteer help, and that when it came to campaigning, “I think we’re going to stick with what we’ve been doing — stay flexible and take the most advantage out of media appearances.”
Democrats say Mr. Johnson could have the biggest effect on Mr. Romney in Nevada, where a Wall Street Journal/NBC News/Marist poll in September showed Mr. Obama and Mr. Romney effectively tied.
Mr. Stone said the campaign believed it had the potential to cut into support for Mr. Romney in three of his must-win states, Florida, Ohio and Virginia — where challenges to the Libertarian candidate quickly failed — as well as in North Carolina and Pennsylvania.
There is very little polling on Mr. Johnson to bear all of this out, which his campaign points to as evidence that he is being unfairly ignored by the news media. However, The Miami Herald and The Tampa Bay Times have measured his support at about 1 percent — far more than the 537-vote margin that was ultimately deemed to have separated Mr. Bush from Mr. Gore in 2000.
“As we all learned in Florida, when something’s close enough, even small numbers can make a difference,” said Charlie Cook, the publisher of The Cook Political Report, which monitors electoral trends.
That appeared to be the thinking when Pennsylvania Republicans sought to go after Mr. Johnson’s petitions, which Mr. Gleason, the party chairman, suspected had been collected with help from Democrats. He noted that many of the signatures came from Democratic precincts of Philadelphia.
One petition gatherer, Tracey Norton of Germantown, said in an interview that she was a Democratic committeewoman, though she said she did not act in a partisan manner when being paid to collect petitions.
In court, the Republicans presented evidence that some petitions had been collected without the proper signatures. But some of that evidence was collected by the private detective, Reynold Selvaggio who, some of the petition workers said in interviews and testimony, flashed his F.B.I. badge “like he was law enforcement,” as one worker, Reynaldo Duncan, said in an interview.
In testimony, Mr. Selvaggio denied Libertarian lawyers’ suggestions that it was an intimidation tactic, saying his badge stated clearly that he was retired and that he said so in his interviews. The judge hearing the case, James Gardner Colins, a former president judge of the Commonwealth Court of Pennsylvania, seemed displeased.
“I have a badge that says I’m president judge,” he said, “but I don’t flash it to anyone, because I’m not president judge.”
His ruling in favor of the Libertarians came down on Wednesday.