The election hasn't even been lost yet. But as John McCain slides towards likely defeat, the sniping between Republican factions has degenerated into something close to outright civil war – one that presages a wrenching struggle for the future of the party.

In the past few days, the feuding has reached to the very top of the campaign, with the McCain camp accusing Sarah Palin, his own vice-presidential running mate, of acting like a "rogue" candidate, going her own way and defying the instructions of her boss's top advisers. "She's a diva," one unidentified McCain aide told CNN. "She takes no advice from anyone ... she does not have any relationships of trust with any of us, her family or anyone else."

Mutual recrimination is the norm in a losing presidential campaign, as aides position themselves for the blame game after defeat. A week before the election, the McCain campaign seems headed in that direction, trailing Barack Obama by between 7 and 10 points in most national polls, and behind in the major swing states that will decide the outcome on 4 November. But the backbiting this time is of rare ferocity.

Download the new Independent Premium app Sharing the full story, not just the headlines

"How did we get into this mess?" Newt Gingrich, former House speaker and a driving force behind the Republican dominance for most of the past 20 years, says of the disarray. "It's not where we should be and it's not where we had to be. This was not bad luck."

For the second time this month, Bill Kristol, a leading voice on the party's conservative wing, used his column in The New York Times yesterday to urge the struggling candidate to throw his advisers to the winds. "He might as well muzzle the campaign," Mr Kristol wrote. Senior McCain staffers were now "spending more time criticising one another than Obama, and more time defending their own reputations than pursuing a McCain-Palin victory."

As Mr Kristol would be the first to admit, 2008 was never going to be easy for Republicans. To win, Mr McCain had to unite and energise the party and, in effect, run against the Republican President of the past eight years, more unpopular over an extended period than any US leader in half a century.

In some ways, the Republican predicament mirrors that of the Tories at the 1997 election – in power for too long and exhausted of ideas. Complicating matters have been Mr McCain's fragile relations with the social conservative Republican base, with which he has clashed frequently in the past.

Another problem has been his age. At 72, he would be the oldest incoming president in history (a factor that weighs more heavily with voters, pollsters have found, than Mr Obama's skin colour). If he loses, Mr McCain will never run for the White House again. The leadership of the party is up for grabs – not a situation that lends itself to harmony.

Finally, he has been unable to find a consistent message. One moment, strategists complain, he has presented himself as hero and patriot with experience, unlike his untested "celebrity" opponent. Then he metamorphosed into an agent of radical change, in improbable contrast to "insider" Obama. Next, the man who made a virtue of playing clean politics waded in, low and dirty, against the Illinois senator. Finally, it was a ticket of "two mavericks" to overturn Washington politics. Unfortunately the mavericks – or their teams – are criticising not so much Mr Obama as each other.

The lightning rod is Ms Palin. As initial excitement at her nomination subsided, party elders began to criticise the choice. The Alaska governor was too inexperienced, they complained, her conservative views would alienate independents. As the debacle of her interview with Katie Couric proved, Mr McCain had blundered in picking her. To which the Palin camp responds that the McCain team made a mess of her "roll-out" and had not "let Sarah be Sarah." Now she is increasingly speaking out for herself. Hence the whispers that she is a "rogue" candidate.

But the dispute also reflects a struggle for the future. Ms Palin is an emblem of the social conservatives, of how that base can be mobilised to win elections, as George Bush did in 2004. "She is playing for her own future," the unnamed McCain aide added, "she sees herself as the next leader of the party." At his most effective, Mr McCain has taken the opposite tack, as a unifier who appeals across party lines. The battle lines have been drawn.