AP

IT IS impossible to forecast how important any presidency will be. Back in 2000 America stood tall as the undisputed superpower, at peace with a generally admiring world. The main argument was over what to do with the federal government's huge budget surplus. Nobody foresaw the seismic events of the next eight years. When Americans go to the polls next week the mood will be very different. The United States is unhappy, divided and foundering both at home and abroad. Its self-belief and values are under attack.

For all the shortcomings of the campaign, both John McCain and Barack Obama offer hope of national redemption. Now America has to choose between them. The Economist does not have a vote, but if it did, it would cast it for Mr Obama. We do so wholeheartedly: the Democratic candidate has clearly shown that he offers the better chance of restoring America's self-confidence. But we acknowledge it is a gamble. Given Mr Obama's inexperience, the lack of clarity about some of his beliefs and the prospect of a stridently Democratic Congress, voting for him is a risk. Yet it is one America should take, given the steep road ahead.

Thinking about 2009 and 2017

The immediate focus, which has dominated the campaign, looks daunting enough: repairing America's economy and its international reputation. The financial crisis is far from finished. The United States is at the start of a painful recession. Some form of further fiscal stimulus is needed, though estimates of the budget deficit next year already spiral above $1 trillion. Some 50m Americans have negligible health-care cover. Abroad, even though troops are dying in two countries, the cack-handed way in which George Bush has prosecuted his war on terror has left America less feared by its enemies and less admired by its friends than it once was.

Yet there are also longer-term challenges, worth stressing if only because they have been so ignored on the campaign. Jump forward to 2017, when the next president will hope to relinquish office. A combination of demography and the rising costs of America's huge entitlement programmes—Social Security, Medicare and Medicaid—will be starting to bankrupt the country. Abroad a greater task is already evident: welding the new emerging powers to the West. That is not just a matter of handling the rise of India and China, drawing them into global efforts, such as curbs on climate change; it means reselling economic and political freedom to a world that too quickly associates American capitalism with Lehman Brothers and American justice with Guantánamo Bay. This will take patience, fortitude, salesmanship and strategy.

At the beginning of this election year, there were strong arguments against putting another Republican in the White House. A spell in opposition seemed apt punishment for the incompetence, cronyism and extremism of the Bush presidency. Conservative America also needs to recover its vim. Somehow Ronald Reagan's party of western individualism and limited government has ended up not just increasing the size of the state but turning it into a tool of southern-fried moralism.

The selection of Mr McCain as the Republicans' candidate was a powerful reason to reconsider. Mr McCain has his faults: he is an instinctive politician, quick to judge and with a sharp temper. And his age has long been a concern (how many global companies in distress would bring in a new 72-year-old boss?). Yet he has bravely taken unpopular positions—for free trade, immigration reform, the surge in Iraq, tackling climate change and campaign-finance reform. A western Republican in the Reagan mould, he has a long record of working with both Democrats and America's allies.

If only the real John McCain had been running

That, however, was Senator McCain; the Candidate McCain of the past six months has too often seemed the victim of political sorcery, his good features magically inverted, his bad ones exaggerated. The fiscal conservative who once tackled Mr Bush over his unaffordable tax cuts now proposes not just to keep the cuts, but to deepen them. The man who denounced the religious right as “agents of intolerance” now embraces theocratic culture warriors. The campaigner against ethanol subsidies (who had a better record on global warming than most Democrats) came out in favour of a petrol-tax holiday. It has not all disappeared: his support for free trade has never wavered. Yet rather than heading towards the centre after he won the nomination, Mr McCain moved to the right.

Meanwhile his temperament, always perhaps his weak spot, has been found wanting. Sometimes the seat-of-the-pants method still works: his gut reaction over Georgia—to warn Russia off immediately—was the right one. Yet on the great issue of the campaign, the financial crisis, he has seemed all at sea, emitting panic and indecision. Mr McCain has never been particularly interested in economics, but, unlike Mr Obama, he has made little effort to catch up or to bring in good advisers (Doug Holtz-Eakin being the impressive exception).

The choice of Sarah Palin epitomised the sloppiness. It is not just that she is an unconvincing stand-in, nor even that she seems to have been chosen partly for her views on divisive social issues, notably abortion. Mr McCain made his most important appointment having met her just twice.

Ironically, given that he first won over so many independents by speaking his mind, the case for Mr McCain comes down to a piece of artifice: vote for him on the assumption that he does not believe a word of what he has been saying. Once he reaches the White House, runs this argument, he will put Mrs Palin back in her box, throw away his unrealistic tax plan and begin negotiations with the Democratic Congress. That is plausible; but it is a long way from the convincing case that Mr McCain could have made. Had he become president in 2000 instead of Mr Bush, the world might have had fewer problems. But this time it is beset by problems, and Mr McCain has not proved that he knows how to deal with them.

Is Mr Obama any better? Most of the hoopla about him has been about what he is, rather than what he would do. His identity is not as irrelevant as it sounds. Merely by becoming president, he would dispel many of the myths built up about America: it would be far harder for the spreaders of hate in the Islamic world to denounce the Great Satan if it were led by a black man whose middle name is Hussein; and far harder for autocrats around the world to claim that American democracy is a sham. America's allies would rally to him: the global electoral college on our website shows a landslide in his favour. At home he would salve, if not close, the ugly racial wound left by America's history and lessen the tendency of American blacks to blame all their problems on racism.

So Mr Obama's star quality will be useful to him as president. But that alone is not enough to earn him the job. Charisma will not fix Medicare nor deal with Iran. Can he govern well? Two doubts present themselves: his lack of executive experience; and the suspicion that he is too far to the left.

There is no getting around the fact that Mr Obama's résumé is thin for the world's biggest job. But the exceptionally assured way in which he has run his campaign is a considerable comfort. It is not just that he has more than held his own against Mr McCain in the debates. A man who started with no money and few supporters has out-thought, out-organised and outfought the two mightiest machines in American politics—the Clintons and the conservative right.

Political fire, far from rattling Mr Obama, seems to bring out the best in him: the furore about his (admittedly ghastly) preacher prompted one of the most thoughtful speeches of the campaign. On the financial crisis his performance has been as assured as Mr McCain's has been febrile. He seems a quick learner and has built up an impressive team of advisers, drawing in seasoned hands like Paul Volcker, Robert Rubin and Larry Summers. Of course, Mr Obama will make mistakes; but this is a man who listens, learns and manages well.

It is hard too nowadays to depict him as soft when it comes to dealing with America's enemies. Part of Mr Obama's original appeal to the Democratic left was his keenness to get American troops out of Iraq; but since the primaries he has moved to the centre, pragmatically saying the troops will leave only when the conditions are right. His determination to focus American power on Afghanistan, Pakistan and proliferation was prescient. He is keener to talk to Iran than Mr McCain is— but that makes sense, providing certain conditions are met.

Our main doubts about Mr Obama have to do with the damage a muddle-headed Democratic Congress might try to do to the economy. Despite the protectionist rhetoric that still sometimes seeps into his speeches, Mr Obama would not sponsor a China-bashing bill. But what happens if one appears out of Congress? Worryingly, he has a poor record of defying his party's baronies, especially the unions. His advisers insist that Mr Obama is too clever to usher in a new age of over-regulation, that he will stop such nonsense getting out of Congress, that he is a political chameleon who would move to the centre in Washington. But the risk remains that on economic matters the centre that Mr Obama moves to would be that of his party, not that of the country as a whole.

He has earned it

So Mr Obama in that respect is a gamble. But the same goes for Mr McCain on at least as many counts, not least the possibility of President Palin. And this cannot be another election where the choice is based merely on fear. In terms of painting a brighter future for America and the world, Mr Obama has produced the more compelling and detailed portrait. He has campaigned with more style, intelligence and discipline than his opponent. Whether he can fulfil his immense potential remains to be seen. But Mr Obama deserves the presidency.