BARACK OBAMA hopes to wrap up the Democratic nomination next week, as the three last primaries, combined with an expected slew of superdelegate announcements, carry him over the threshold of victory. Already, his team is focusing on winning the White House. With an electorate sick of war, costly petrol and George Bush, the odds favour him. Intrade, a betting site, puts his chances at 58%.

If he (or, should a miracle occur, Mrs Clinton) stumbles, however, it may be because the electoral college has worked against the Democrats. With five months of campaigning still ahead, all predictions should be taken with a fistful of salt. Nonetheless, it is at least plausible that he (or she) might rack up pointlessly large majorities in liberal states while narrowly failing to carry enough swing states to win.

Geography, as so often in history, is key. The electoral map did not change much between the last two presidential elections. Only three states, all small, switched sides between 2000 and 2004: Iowa, New Hampshire and New Mexico. But this year could be very different. John McCain is an unusual Republican, distrusted by the party's evangelical base but popular with independents. Mr Obama's prospects are even harder to discern, since no black American has ever come this close to the presidency and people may lie to pollsters about his candidacy.

How, then, might the electoral map be redrawn this year? A good place to start looking is California. Most analysts say that this is probably not a swing state: John Kerry carried it by ten points. But since it is the biggest prize, with 55 electoral votes out of the 270 needed to win, it cannot be ignored. California's Latinos like Mr McCain's pro-immigration stance, but many of them loathe his party. The California Republican Party is a mess, stuffed with nativists and managing to be simultaneously chaotic and doctrinaire. Mr McCain's age may also count against him in a state where youth is worshipped.

On the plus side for Mr McCain, his defence of free trade will hurt him less in the Pacific West than in the rustbelt, since the region visibly benefits from trade with Asia and Mexico. Coming from next-door Arizona, he has a feel for Western issues, such as water and public-land use, which Mr Obama lacks. And California's popular Republican governor, Arnold Schwarzenegger, will lend Mr McCain some star power on the hustings.

In Florida, with its crucial 27 electoral votes, the picture is reversed. Even though he cannot take anything for granted, Mr McCain is roughly eight points ahead in the polls. Mr Obama has serious problems in the Sunshine State. He struggles to woo elderly voters. His idealistic approach to tyrants strikes Cuban-Americans in Miami as naive. What is more, if the Democratic Party cannot find a way to make the votes cast in Florida's Democratic primary this year count, many Florida Democrats who supported Hilary Clinton will still be seething in November.

Another point in Mr McCain's favour is that Florida's governor, Charlie Crist, who is even more popular and perma-tanned than Arnie, backs him whole-heartedly. There is talk of Mr McCain picking Mr Crist as his running-mate—he was one of three possibles invited to the senator's ranch last week. Mr Crist's current bachelorhood may count against him with socially conservative voters, but Mr McCain really needs to win Florida.

The closest battles in big states could be in Pennsylvania and Ohio. Both states have a lot of white working-class voters who think the economy is in terrible shape and foreign trade is much to blame. Their protectionism pulls them to vote for Democrats. But their love of guns and distaste for abortion pull the other way.

Mr Obama simply has to hold Pennsylvania. Polls show him six points ahead of Mr McCain, but his thrashing by Hillary Clinton in the primary should give him pause. He might woo her supporters by choosing Ed Rendell, the governor of Pennsylvania and a long-time Clintonite, as his running-mate. Doing so, however, would prevent him from picking the governor of Ohio, Ted Strickland, another Clinton loyalist whose help he might well need. Ohio, with its 20 college votes, single-handedly tipped the 2004 election to Mr Bush.

A poll of polls by RealClearPolitics.com shows Mr Obama only a whisker ahead of Mr McCain in Ohio. Voters there tend to prefer Mr Obama's economic populism, but to think Mr McCain would be a more reliable commander-in-chief. Mr McCain could perhaps blunt Mr Obama's advantage on economic issues by picking Rob Portman, a former head of the Office of Management and Budget, as his vice-presidential nominee. Not only is Mr Portman widely admired; he is also from Ohio.

Mr Obama faces several challenges in his own backyard. Across the lake from his home state of Illinois lies Michigan, a Democratic state whose 17 electoral votes are up for grabs. As luck would have it, Michigan is the other state where Democratic primary votes seem unlikely to count this year, leaving many Hillary-loving locals angry. Polls show Mr Obama and Mr McCain neck and neck there, though Mr Obama's NAFTA-scapegoating is an easier sell than Mr McCain's blunt assertion that “some of the jobs that have left the state of Michigan are not coming back.”

Three more states that border Illinois will be fiercely contested: Missouri, Iowa and Wisconsin. Missouri went for Mr Bush by seven points in 2004, but turfed out a Republican senator in 2006. Because eastern Missouri touches Illinois, people there have been able to watch Mr Obama's TV adverts since before he was nationally famous. And sizeable black populations in St Louis and Kansas City will flock to him. Many in Missouri are culturally conservative, however, and Republicans will remind them of Mr Obama's ultra-liberal voting record in the Senate.

Wisconsin, with ten electoral votes, narrowly backed Mr Kerry in 2004. Mr Obama, who did well in the Wisconsin primary even among groups he normally fails to excite, such as white blue-collar workers, hopes to do better. The polls are all over the place.

AP

In happier times

Iowa is smaller, with only seven electoral votes, but the terrain favours Mr Obama. Mr Bush won there by a single point in 2004. Mr Obama kick-started his national career by winning the Iowa caucuses in January. Mr McCain, who resists showering corn farmers with subsidies, lost miserably there.

Mr Obama hopes that the vast enthusiasm for his candidacy among African Americans will translate into electoral votes. It will help, of course. But unfortunately for him, America's black population is concentrated in the South, most of which seems impregnably Republican. Some 30% of Georgians, for example, are black, but even a huge increase in black turnout will be hard pressed to overturn the 17-point margin by which Mr Bush won there in 2004. Mr Obama's chances are better in the upper southern states of North Carolina and Virginia. Both voted for Mr Bush, but both are becoming more liberal as yuppies move in. A combination of blacks and college-educated whites has given both states Democratic governors.

Mr Obama is six points behind Mr McCain in North Carolina and only one point behind in Virginia. Armchair strategists urge him to pick a Virginian running-mate. Tim Kaine, the governor, is often mentioned. So is Jim Webb, Virginia's junior senator and a former secretary of the navy. Mr Webb would shore up Mr Obama's perceived weakness on national security. But some harsh things he once said about women in combat will upset a lot of former Hillary voters.

Among Mr McCain's targets is Minnesota, which has not voted Republican in a presidential race since 1972 but is turning purple. Mr Kerry won the state by three points. Mr Obama's poll lead is larger, but fragile. The Republicans will be holding their convention in Minneapolis-St Paul this year. And Mr McCain might pick Minnesota's governor, Tim Pawlenty, as his running-mate. Party insiders warm to both Mr Pawlenty's record and his humble roots. His mother died when he was 16. He says he wants the Republicans to be “the party of Sam's Club [ie, people who shop at Wal-Mart], not the country club”.

The final battleground will be in the Mountain West, where libertarian voters like their taxes low and their government unpreachy. This makes Colorado, Nevada and New Mexico all “purple” states, which is why Mr Obama visited all three this week and the Democrats will hold their convention in Denver.

Colorado voted for Mr Bush by five points but elected a Democratic governor in 2006. Nevada backed Mr Bush by two points but constantly re-elects the Senate majority leader, Harry Reid. New Mexico backed Mr Bush by one point but has a Democratic governor, Bill Richardson.

Mr McCain will make much of his local-boy status, since Arizona touches all three states. Were he to pick the conservative Mike Huckabee as his running-mate, however, he would alienate the Mormons in Nevada, who resented the former Arkansas governor's unsubtle digs at their faith during his Republican primary tussle with Mitt Romney, a Mormon. But even winning all three would not compensate Mr Obama for a loss in Pennsylvania.

The sheer number of battleground states plays to Mr Obama's strengths. He will have much more money than any previous presidential candidate, and will be able to unleash a barrage of ads on every battlefield. He can fight hard for every remotely winnable state and force Mr McCain to spend time and money defending supposedly safe ones. Both candidates' vice-presidential picks will be endlessly scrutinised. Seasoned observers say running-mates seldom affect the final result. But if the race is close, both sides will look for any advantage they can find.