A Karzai supporter celebrates in Herat, western Afghanistan
By Paul Reynolds
World affairs correspondent, BBC News website
Western governments have suddenly transformed Afghan President Hamid Karzai from tainted candidate into legitimate victor.
A key factor was the decision by his main opponent, Abdullah Abdullah, to withdraw from the second round of voting and not to boycott it.
A boycott might have meant that a second round had to go ahead, with further violence.
A withdrawal left President Karzai as the only candidate. With no apparent appetite for another vote, which would probably not have changed the outcome, the result was declared and the calls of congratulation started flooding in to Mr Karzai.
The US and British governments let it be known that they regarded the result as legitimate and constitutional and that it reflected the will of the people.
Suddenly there was talk that the Afghans did not really want another vote, that they saw it as foreign meddling.
There was no further reference to fraud. It was pointed out that the figures were more or less in line with the opinion polls - President Karzai, the candidate of the majority Pashtun people, in the high 40s and Dr Abdullah in the low 30s.
Indeed, the Karzai victory is being praised as more diverse than his first in that he won 75% of the Pashtun vote and was backed by significant numbers among other ethnic groups.
Gen Stanley McChrystal wants another 40,000 troops
The fraud was all but dismissed as the result of enthusiastic Pashtuns making up votes.
However, the praise stopped there. There are conditions attached.
The first is that the Afghan government has to start taking a lead in security operations. This was already one of the conditions attached to the British government's decision in principle to increase its forces by 500 to 9,500.
But it goes well beyond that into a strategic necessity. The international forces have to be seen as acting in support of the Afghan government and not the other way round.
This is easier said than done and it does not sit easily with the recommendations of the US commander, Gen Stanley McChrystal, who wants another 40,000 troops.
That does not sound as if he has much confidence in the Afghan government "taking ownership" of security, as it is so often put by Western officials.
US President Barack Obama has not yet made up his mind on the request for more troops. His decisions might well depend on these conditions actually being met.
The second is that there have to be moves to end corruption and get better government.
President Karzai is being told that he needs a strong cabinet of clean and competent people. His own recent statement during the visit by Senator John Kerry that he is seeking a national unity government, not a coalition, is seen as a start at least.
A national unity government would be broad-based. A coalition would be a cabinet of cronies.
President Karzai now has another five years - and cannot serve another term. That roughly gives a framework for success or failure.
Failure will be obvious. Defining success is harder.
A new report from a US think-tank, the Center for a New American Security, written by a former US army officer, Andrew Exum, sketches out three scenarios.
The first, the worst-case, is that Afghanistan goes back to the pre-September 2001 Taliban days, where al-Qaeda groups can live and train. This is, the report says, as "frightening as it is unlikely".
The second is that the rest of Nato tires of the conflict and the war is narrowed down to the US supporting its Afghan allies in a long-term struggle. This is the "most likely scenario".
The third is that a "functioning Afghan state" emerges "inhospitable to transnational terror groups".
The report says that the third scenario is "still possible" but would "almost certainly require a further commitment of precious US time and resources..."