NOT all that long ago—three years, to be exact—the Republican Party was rooting for John McCain to be president of the United States. The senator from Arizona, you may remember, had in his time worried about climate change, shown an open mind towards “cap-and-trade” to reduce carbon emissions, and worked closely with Democrats like the late Ted Kennedy to reform immigration law to give illegal immigrants a path to citizenship. Bit by bit, he had to retreat from these positions to win his party's nomination.

Today the Grand Old Party has moved even farther to the right. Herman Cain, the former pizza mogul from Georgia now leading some polls in the race for the nomination, had to clarify that he was joking when he said he wanted to build a lethal electrified fence along the entire border with Mexico. As for global warming, most Republicans say that there is no such thing, or that if the Earth really is warming it has nothing to do with human activity. Another candidate, Governor Rick Perry of Texas, has called global warming a “contrived phoney mess that is falling apart under its own weight”.

The party's shift on economics is no less striking. The big-government conservatism of George Bush's presidency is seen not only as a mistake but as a betrayal. “We had our chance and we blew it,” says Eric Cantor, the majority leader in the House of Representatives, of the party's consecutive terms in government between 2000 and 2008. George Bush senior is remembered no more fondly. Didn't his decision to break a promise and raise taxes lose the Republicans the White House in 1992?

On the face of it, this shift to the right has already paid dividends. In the presidential election three years ago Barack Obama romped to victory with 365 electoral-college votes, 192 more than Mr McCain, and almost 53% of the popular vote. Since then, however, the Republicans have experienced an almost miraculous resurrection.

In the mid-terms of November 2010 they won control of the House of Representatives, an extra six seats in the Senate and six more state governorships, bringing the total number of state houses under Republican management to 29 out of 50. They have an excellent chance in November next year of capturing the Senate, and a fair chance of grabbing the White House, turning Mr Obama into the first one-term president since George Bush senior. An average of polls maintained by RealClearPolitics, a website, suggests that 44.8% of voters intend to vote for a Republican in 2012 and 41.8% for Mr Obama.

To a degree, they owe this turnaround to luck—Mr Obama's bad luck. Within months of his election he bet $800 billion on a Recovery Act that was supposed to jolt the economy back to life. This stimulus, alas, was not stimulating enough: though growth perked up to 2.5% in the last quarter, unemployment is stuck obstinately above 9% (that is 14m Americans) and is not expected to fall much before next November's election. The RealClearPolitics average shows that the proportion of Americans disapproving of Mr Obama's performance jumped to 51% in October from 20% in January 2009. Around 75% say the country is on the wrong track.

For the Republicans, these are mouth-watering numbers. Nothing seems to stand in their way. But to triumph next November they need a plausible presidential candidate and a programme that appeals to the broad electorate, not just the party faithful who will select a nominee after January's caucuses in Iowa kick off the season of primary elections. And this, in turn, poses a question. Are Americans looking for nothing more than a safe alternative to a president who has failed? If so, they might do worse than plump for Mitt Romney, a former governor of Massachusetts and a primary candidate last time: a known quantity with what looks like a safe pair of hands. Or are they hankering after a revolution?

The Republican Party finds it hard to get the answer right because it has just undergone a revolution of its own. One of the main things that snapped the party out of its doldrums after the debacle of 2008 was the eruption of the tea-party movement, a largely self-organising group of small-government conservatives who believe that big government has throttled the freedoms bequeathed by the Founders.

Tea-partiers ascribe the party's resurrection not only to Mr Obama's bad luck and “socialist” policies but also to their own determination to slay the Leviathan-state and restore lost liberties. The last person they want in the White House is another government-expanding “compassionate conservative” like Bush the younger. They yearn for a radical who will yank an out-of-control federal government up by its roots, or at least starve it of revenue, prune entitlements, chop away job-strangling regulation and free (or force) citizens to take more individual responsibility for their pensions and health care.

To many Republicans this is an inspiring prospectus. And yet its very radicalism may become the party's Achilles heel. It could enable Mr Obama to win a second term by proclaiming that to vote Republican in 2012 is to opt for a reckless experiment that will tear down all the social protections Americans have come to take for granted.

Mr Obama is already pushing this line. One of his chief exhibits is the Republicans' comportment during the past year of divided government. The freshmen swept in when the Republicans recaptured the House in 2010 dragged a Republican caucus that was already conservative by historical standards farther to the right. One of the first things the new majority did was to pass a bill repealing what they call Mr Obama's “job-killing” health-care law, or “Obamacare”. They also cheered through a radical budget plan drawn up by Paul Ryan of Wisconsin that would scythe down entitlements and, in particular, will make the well-loved Medicare plan for the elderly much less generous. Voters do not like that idea.

Taxes as poison

Because the Democrats still control the Senate, neither the repeal of Obamacare, nor Mr Ryan's plan, nor many of the other bills the House has passed has become law. The year of gridlock reached a low point in the midsummer showdown over the federal debt ceiling. The Republicans boast that, by refusing to raise the amount the government could borrow until the Democrats agreed to reduce spending, they forced Mr Obama to make a belated start on tackling the deficit. But they also brought the United States close to its first-ever default, prompting Standard & Poor' s to downgrade its AAA credit rating to AA+. Though none of the politicians emerged with much credit in voters' eyes, a poll afterwards showed that more (72%) were inclined to disapprove of how the Republicans had handled the crisis than blamed the Democrats (66%) or Mr Obama (47%).

The Republicans say they won a victory. But the showdown exposed the party to the charge of recklessness, highlighted its rigidity on taxes and seemed to reveal a rift. At one point John Boehner, the speaker and nominal leader of the Republicans in the House, started to talk to Mr Obama about a “grand bargain” entailing not only the spending cuts the Republicans insisted on but also the tax increases Democrats call unavoidable to protect vital programmes. These talks broke down, however, leaving the impression that the pragmatic Mr Boehner had been overruled by the anti-tax ideologues in his own caucus.

Even the sainted Ronald Reagan was willing to raise taxes when circumstances required. Most of today's Republican lawmakers have signed an explicit pledge never to do so, even though this puts the party on the wrong side of public opinion. Most voters tell pollsters they favour a balanced approach to the deficit, meaning tax increases as well as spending cuts, with a bigger share of the taxes coming from the rich. And this issue is not going away.

After the debt showdown the two parties created a congressional “supercommittee”, which by November 23rd must present a plan to reduce the deficit by $1.2 trillion-1.5 trillion over the next ten years. The Republicans still say that this must be done by spending cuts alone, the Democrats that tax rises must be part of the solution. To encourage compromise, Congress has pointed a pistol at its own head. If the committee fails to produce an agreement, or Congress fails to approve it, $1.2 trillion of cuts—half of them falling on the hallowed defence budget—will be triggered automatically. Yet the Republicans have squeezed themselves into a straitjacket. In a debate in Iowa in August, all eight presidential candidates said that even if the Democrats were to offer $10 of spending cuts for every dollar of increased taxes, they would turn such an offer down.

One of the things that keeps the party in its straitjacket is the tea-party movement. Its influence is hotly debated. When the movement began the Democrats disparaged it as an “astroturf” phenomenon, an artificial protest stirred up by corporate interests. That was nonsense, as anyone visiting these spontaneous gatherings could see. Since then, however, the tea parties' role has evolved. They may be no less “authentic” than at the start, but they are now woven tightly into the Republican grassroots, co-ordinated nationally and plugged into a variety of deep-pocketed small-government outfits, such as the Club for Growth, FreedomWorks and Americans for Prosperity, which feed them with policy ideas and help them organise.

In a forthcoming book (“The Tea Party and the Remaking of Republican Conservatism”), two Harvard University academics, Theda Skocpol and Vanessa Williamson, say that the emergence of the tea-partiers was “just what the doctor ordered” for a group of billionaire ideologues, such as brothers Charles and David Koch of Koch Industries, who lost no time exploiting the movement's anger and energy. Dick Armey, the founder of FreedomWorks, and Matt Kibbe, its president, have been candid about their efforts to turn the tea-party movement into “a permanent grassroots army” and mount a “hostile takeover” of the Republican Party.

The new Jacobins

This is code for a merciless purge. Seniority in the party and length of service in Congress are no protection. In the primaries before last year's mid-terms, tea-partiers helped to scalp long-serving Republicans, such as Senator Bob Bennett of Utah, who used to be considered solid conservatives. Now the Jacobins are on the warpath again. FreedomWorks is hoping to unseat Senator Richard Lugar, who has represented Indiana admirably for six terms, by throwing its weight behind Richard Mourdock, “a reliable, consistent supporter of limited government”. Mr Lugar stands accused of spending his 34 years in Congress “voting to spend too much and to expand the federal government too far beyond its constitutional limits.”

Campaigns such as these push the party in Congress to the right. They have also coloured the search for a presidential nominee. The contenders are by no means clones. Ron Paul, a libertarian from Texas, is only too happy to challenge party dogmas, such as reflexive support of Israel. The three social conservatives—gut ones such as Rick Santorum of Pennsylvania and Michele Bachmann of Minnesota, and the more cerebral Newt Gingrich—differ on many details. But they differ within a relatively narrow spectrum.

Almost all the candidates oppose gay marriage and several say they would reinstate “Don't ask, don't tell”, the ban on homosexuals serving openly in the armed forces, which Mr Obama recently repealed. When Mr Cain said on television that although he opposed abortion, it was ultimately a decision for the family or the mother, he came under withering attack and quickly backtracked. He now says, as Mr Santorum does, that there must be no exceptions, even in cases of rape or incest.

Above all, the whole Republican field has embraced the mantra of small government. To judge by their promises, a Republican victory in 2012 would see a night of long knives in Washington, DC. On his very first day Mr Gingrich would abolish 39 White House “tsars”. In his first year Mr Paul would lop away $1 trillion in federal spending and abolish the departments of energy, commerce, interior, education, and housing and urban development. Mrs Bachmann would do away with the department of education and have the “doors locked and lights turned off” at the Environmental Protection Agency. Whoever wins, Obamacare—and who knows what else?—will be on their way to the chopping-block. Mr Perry has called Social Security, the pension system on which millions of Americans depend, not only unconstitutional but a Ponzi scheme.

A wobbly heir-apparent

Obstructive, reckless, extreme, willing to dismantle the whole edifice of the New Deal—if Mr Obama can make that picture of the Republicans stick, their hopes of victory will be at risk. In recent weeks the White House has rolled out a series of initiatives under the rubric “We can't wait”, designed to portray the Republicans as running a do-nothing Congress like the one that tried to obstruct Harry Truman's efforts to minister to the economy after the second world war.

Is it fair? Republicans retort that they have passed more than a dozen bills in the House, only to see them blocked by the Democrats' do-nothing Senate. They can also point to bold policies in states across the country, where Republican governors have been slashing spending, clipping the wings of over-mighty public-sector unions and spurning handouts from the federal government. Harsh remedies are needed, they say, in states short of revenue and deep in debt. Some governors (John Kasich in Ohio, Scott Walker in Wisconsin) have pushed further than voters like, but others have won plaudits. Last week Bobby Jindal cruised to re-election in Louisiana, where voters give him high marks for streamlining government and tackling ethics abuses. Mitch Daniels of Indiana or Chris Christie of New Jersey might have been excellent presidential candidates had they chosen to run.

But they didn't, and for those who did it has so far been a peculiar race. The usual Republican pattern is to settle early on an heir-apparent. In this cycle Mr Romney is the closest the party has to that. He enjoys a commanding lead in early-voting New Hampshire and Florida. In a National Journal survey of “political insiders” at the end of October, Republicans said virtually unanimously that he would emerge as the nominee. Intrade, an online betting firm, gave him a 70% chance of winning the nomination (against 11% for Mr Perry and just over 7% for Mr Cain).

And yet in months of campaigning Mr Romney has struggled to win over more than 25% of Republican voters, and every so often another candidate shoots ahead of him (see chart). For a while Mrs Bachmann did well. Then, after declaring in August, Mr Perry soared ahead of Mr Romney, only to plummet because of ghastly debate performances and a row over his alleged softness towards illegal immigrants. In recent weeks it has been the likeable Mr Cain's turn to lead the field, buoyed up not only by his oratorical skills and folksy charm but also by his snappy plan to reform the tax system. What is it that turns Republicans off Mr Romney? Apart from being dull and being Mormon, which still fans suspicions, the famous flip-flopper is also—with the exception of his fellow Mormon, Jon Huntsman—the least authentic conservative in the race. As governor of Massachusetts, he introduced an early form of Obamacare. Once pro-choice, he is now pro-life. That has given his rivals an easy line of attack—voters won't get any “shape-shifting nuance from me”, boasts Mr Perry—and makes it extremely hard for him to win the support of the tea-partiers. Chris Chocola, president of the Club for Growth, said last month that Mr Romney would be an improvement on Mr Obama (not extravagant praise in such circles), but that his economic ideas were not yet “bold” enough. In short, the tea-partiers are still looking for their revolutionary. Perhaps they should beware of what they wish for. Since the election of Mr Obama, the Republicans have done an admirable job of shifting the debate. The need for America to reform the spending programmes, such as Medicare, which are pushing the country towards bankruptcy is now widely accepted. But the party is also seen as the party of the rich. In a recent New York Times/CBS News poll, 69% of respondents said that Republican policies favoured the wealthy, while only 28% said that of Mr Obama's policies. This is not a plus at a time of stark and rising inequality. Rich v poor

The Congressional Budget Office reported last week that the top 1% of earners had more than doubled their share of national wealth over the past three decades. The Occupy Wall Street movement, “the 99%”, is kicking up a ruckus. And yet Republican candidates have been falling over themselves to invent tax proposals that look bound to squeeze the poor and reward the rich even more. Mr Cain's 9-9-9 plan would cut corporate and personal income taxes to 9% and make up the revenue with a sales tax. Mr Paul would abolish the federal income tax altogether. Mr Perry and Mr Gingrich have different blueprints, but all are highly regressive and none seems likely to sustain government revenue at present rates. That may be fine for the zealots: government is the problem, remember. But is it what most voters want?

Maybe not. Larry Bartels, a political scientist at Vanderbilt University who has studied election results since the recent great recession, concludes that they are seldom decided by ideology. “In periods of economic crisis, as in more normal times, voters have a strong tendency to support any policies that seem to work, and to punish leaders regardless of their ideology when economic growth is slow,” he says. That is bad news for Mr Obama. But the Republicans still need to unite around a plausible candidate—and a programme that is not so scary that voters will decide to stick with the president they know.