The first warning sign was delivered in a phone call nine days ago, when John McCain's new senior adviser, Steve Schmidt, held a conference call with worried senior Republican party figures.

Schmidt told them that they would soon see McCain go on the offensive against Barack Obama. Some tough TV ads were coming, he warned. It was no lie. The first ad came barely 24 hours later. Others followed, and soon the US presidential election erupted into its most vicious fight so far. Both sides traded insults over patriotism, racism and allegations of becoming negative. It dominated the front pages and cable news shows, and there is little sign that the storm will abate quickly.

Many pundits saw the move as a sign of desperation from a McCain campaign humbled by Obama's triumphal world tour, behind in the polls and written off by some commentators. But the truth is very different.

McCain's aggressive strategy is a deliberate and well-thought-out ploy. It was developed and implemented by a coterie of advisers brought in last month who are protégés of the Republican political guru Karl Rove. Schmidt, who learnt his trade with Rove, heads the group and is now guiding the campaign.

The strategy is intended to turn McCain's ailing presidential bid around and give it a firm focus: one mostly fixed on attacking Obama. Schmidt and others believe they can do to Obama what the Republicans did to John Kerry in 2004.

'They know how to win a presidential election. If you can show a candidate's basic flaws, that is one way to win,' said Steve Mitchell, a Republican political adviser and chairman of Mitchell Research. McCain's new advisers believe they can define Obama in their own terms and leave him as damaged goods in the eyes of the electorate. If that sounds like a hard-headed, unpleasant, negative strategy, that is probably because it is. But Schmidt and his allies have also started to give Republicans the one thing that Obama had seemed to be monopolising - hope of winning.

Steve Schmidt is known as 'The Bullet'. Part of that is to do with his bald-headed appearance, but it is also as much to do with his hyper-aggressive political style. He was promoted to run McCain's campaign at the beginning of last month, after he and several other aides went to McCain and warned him that his presidential bid was in dire trouble.

McCain took the warning to heart and placed Schmidt in charge of the day-to-day running of his campaign operation. It was a bold move, but Schmidt is one of the rising stars of Republican politics. The New Jersey native cut his teeth under Rove and in the Bush White House. He ran the 2004 Republican war room that was responsible for taking down Kerry. He also worked hard on getting conservative judges through the process of appointment to the Supreme Court. Then he guided the re-election campaign of California governor Arnold Schwarzenegger, to victory.

Schmidt has been joined by other key figures from the Rove-era Bush White House. They include the formidable figure of Nicole Wallace, a Bush campaign spokeswoman in 2004, and Greg Jenkins, a former Fox TV journalist who once worked for Bush's campaign. The group has sought to tighten an operation that was floundering under its previous leadership. They have also given it a sharply negative edge.

However, such a strategy is not without risk. Much of McCain's huge appeal to the middle ground relies on his popular reputation as a military hero and a decent man. Excessive negative campaigning could hurt that valuable political commodity. 'This is a first for McCain. This is a very different strategy to see in a McCain campaign,' said political scientist Tim Hagle, a professor at the University of Iowa.

The tactics have certainly caused despair among some McCain allies. Republican Senator Chuck Hagel, a close friend of McCain and former strategist, broke his silence to label recent attack ads comparing Obama with celebrities like Britney Spears as 'childish'. He also said another ad, which criticised Obama for not visiting wounded US soldiers, was 'inappropriate'.

But such grousing is unlikely to worry the new team. They are far more concerned in recovering from months of campaigning in which Obama has emerged as the clear favourite to triumph in November. McCain is behind in most polls, lacks the glamour of Obama, faces an unenthusiastic Republican base and has much less money.

However, the team is tackling all those issues, not least with last week's ads. The first, dubbed 'Troops', aired last Saturday and attacked Obama as caring more about going to the gym than meeting the military. In a move of marketing genius, it was first aired as part of a news story. When it was finally shown in a paid-for slot - on a TV channel in Denver - it immediately became a talking point. It was broadcast on TV, radio and newspaper websites. Yet, in its first 24 hours, it only aired about six times as an ad.

The same happened with the second ad, 'Celeb'. Although Spears and Paris Hilton appeared only for a brief second, their inclusion guaranteed massive media coverage. But this ad also revealed the Karl Rove-style thinking behind McCain's campaign. It is a truism of Rovian political tactics - inherited by Schmidt - that you attack an opponent's strength. For Obama, that is his charisma and ability to generate huge crowds of enthusiastic people. The ad tried to turn that into a disadvantage. It was a tactic that worked superbly against Kerry in 2004, when the Republican war room - led by Schmidt - undermined Kerry's record as a Vietnam war hero.

There are also signs that the McCain campaign might be tapping into feelings about the often fawning coverage of Obama. US late-night talk shows are starting to mock Obama's campaign. David Letterman recently delivered one of his trademark 'Top 10' lists on the subject of signs that Obama had become overconfident. They varied from 'Had head measured for Mount Rushmore' to 'Offered McCain a job in gift shop at Obama presidential library'. The Daily Show's Jon Stewart joked that Obama's trip to Israel was so that he could visit his birthplace in Bethlehem. Indeed, within the McCain camp itself the nickname they have given Obama is 'The One'.

Away from the jokes, there is also a belief that some hard realities, and even harder tactics, could burst the bubble of good press that has surrounded the Obama campaign since he beat Hillary Clinton to the Democratic nomination.

Many Republicans believe that the controversy surrounding the Rev Jeremiah Wright, Obama's former pastor, will return to haunt him. That would inject race into the campaign in ways that were hinted at last week. When McCain's camp recently accused Obama of playing the race card, it was the first time the subject of his skin colour had directly come up. Many Republican strategists believe that McCain is most likely to benefit from that. 'The more race comes into the debate, the less likely it is that Obama will win,' said Mitchell.

That contention is not proven. But prominently airing the Wright issue in the final month of the campaign would surely test that theory. McCain's camp is unlikely to bring up the Wright issue, but there are many Republican surrogates who will probably do that job enthusiastically. Again, the echoes of the campaign that derailed Kerry are troubling for Democrats. 'Come October, Wright's name recognition is going to be 99 per cent,' said Mitchell.

That could be true. US elections are often dogged by predictions of an 'October surprise', but in 2008 the 'surprise' against Obama may turn out to be very predictable.

Yet Barack Obama is no John Kerry. Obama's campaign has run a ruthlessly efficient response team to the McCain attacks. They have set up websites that address many of the criticisms and Obama has not hesitated to fight back, often within hours or even minutes of the latest assault. In 2004 Kerry was often accused of dithering before responding. In 2008 Obama and his team do the opposite.

But last week's attacks did rattle the Obama camp and led to some strange pronouncements. Robert Gibbs, a senior aide, retreated from Obama's assertion that Republicans were pointing out his race. 'Barack Obama in no way believes that the McCain campaign is using race as an issue,' he said.

That contradicted Obama's own comments, where he explicitly stated that his opponents were using his background to attack him. 'What they're saying is... he doesn't look like the other Presidents on the currency,' Obama said repeatedly on recent campaign stops in Missouri.

That outbreak of disunity adds to nagging doubts over Obama's performance in the polls. He has enjoyed several months of positive press coverage, whereas McCain has been ignored or ridiculed for a series of gaffes.

But Obama's lead is still narrow. In the RCP National Average of polls, he is ahead by just 2.6 points. The picture is similar in key battleground states like Colorado, Ohio and Virginia, where he is ahead by only a few points. McCain is actually ahead in other vital states, like Florida and Missouri.

'It is surprisingly close,' said Tim Hagle. 'Some people, especially in the media, think that Obama is now like Hillary Clinton at the start of her campaign. That all she had to do was just turn up. Well, we know how that turned out.'