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.