Profile: Ashraf Ghani
Ashraf Ghani first came to prominence in Afghanistan running the loya jirga - the grand meeting of elders after the fall of the Taliban in 2001.
He was then close to President Hamid Karzai and served as finance minister from 2002-2004 alongside his future opponent Abdullah Abdullah, who was foreign minister in the same administration.
Mr Ghani had previously been an academic in the US, and worked for the World Bank. And when he fell out with President Karzai in 2004, he was appointed Chancellor of Kabul University, where he was seen as an effective reformer.
He also set up an international institute to advise fragile economies, advising some African countries as well as Nepal, on how to recover from conflict.
He was a vocal critic of the way international aid money was being wasted in Afghanistan, and in particular money from the US, which he saw as operating in a "parallel state", which hired the best Afghans to service foreign offices in Kabul, rather than building effective Afghan institutions.
In a BBC interview in 2007 he said: "When we build a school by Afghans, the maximum cost is about $50,000. But when it is built by our international partners the cost can be as high as $250,000."
The difference was caused by the fact that contractors, many of them foreign, took percentages. He said: "It's totally legal, but is it not corrupt?"
However, he had little political support in Afghanistan then, running an ineffective campaign to be president in 2009. He came a poor fourth in a race that was again won by President Karzai.
With Mr Karzai barred by the constitution from standing for a third time, Ashraf Ghani mounted a far better campaign in 2014. He built a solid base of support after raising his profile in province after province as the head of the team managing the transition of military control from the US-led coalition to Afghan forces.
One view of the long negotiations to form a new government was that he kept his nerve, protecting the Afghan constitution, and insisting that the election result be announced.
But on the other hand, it could be said that he presented an obdurate face against compromise - refusing to give anything in exchange for Mr Abdullah's early concession that Mr Ghani should be president.
He presented a confident public face, refusing to criticise Mr Abdullah, or express impatience as the weeks of negotiations went into months.
This went against his well-known reputation for having a quick temper.
He was even comfortable enough to tell a joke against himself, in the one public appearance he made during the last month of talks. He said: "A year ago Dr Abdullah's team said 'you get angry quickly'. But now they say 'your quietness is making us angry'."
But he tarnished his international reputation as a clean technocrat by his choice of running mate.
Even in Afghanistan, where many in the elite have blood on their hands, General Abdul Rashid Dostam has a more notorious past than many others. In a newspaper article during his 2009 campaign, Ashraf Ghani called him a "known killer".
But during the campaign he said that his running mate was an advantage.
"It is a question of dealing with the past in a credible way, that we practise what we say about inclusion," he said.
Gen Dostam remains popular in parts of the north and the alliance was a pragmatic decision that delivered votes in places where Ashraf Ghani had no profile.
During the campaign, some voters at a rally in Kunduz told the BBC that they had come to hear Gen Dostam, and asked: "Who is the other man with him?"
Although his campaign was far better organised in 2014 than 2009, particularly in the second round, his victory was not complete, and is tarnished by the discovery of far more fraudulent votes on his side than for Dr Abdullah.
He quickly acknowledged the need for forming an inclusive government, saying that this election would not be concluded in a "winner takes all" manner.
The deals and compromise he has had to make to get into office may dull the edge of Ashraf Ghani's ambitious plans to reform his country.
He said during the campaign: "Corruption would not be eliminated in a day, but in five years you will see a very different country."
But he is not without international critics. His time at the World Bank coincided with the "Washington consensus", now criticised by many in the development community for imposing too severe limits on government finances.
And while no-one doubts his intellect, some here still wonder if a man with a background as a technocrat has the political skill to deliver results in the complex arena of Afghanistan.