– Afghans go to the polls next weekend to choose a new president, and that in itself may one day be considered Hamid Karzai’s greatest achievement.

There has been no shortage of criticism of Karzai in recent years. His mercurial behavior and inability or unwillingness to tackle corruption in his government have been well documented.

But in a nation hardened by decades of war, the fact that he is stepping down as president in the first democratic transfer of power ever is no small matter. It is made possible by a constitution that Karzai helped draft and that prohibits him from serving a third five-year term.

The April 5 election “is a historical marker that will in many ways determine I think not only how he’s seen in history if he achieves that but will also be a very important indicator about the future of this country,” U.S. Ambassador James Cunningham said last week.

Cunningham said the differences between Karzai and his former American backers will most likely be relegated to a mere historical footnote. Karzai has refused to sign a security pact with the U.S. that would allow thousands of foreign forces to remain here after the end of 2014. Despite overwhelming public support for the deal, he left the decision to his successor. Many believe Karzai simply did not want to be remembered as the president who permitted foreign troops to stay in Afghanistan.

Karzai inherited a broken country when the Americans and their allies chose him more than 12 years ago as a leader they hoped could cross ethnic lines, embrace former enemies and bring Afghans together. As he prepares to leave office, Afghanistan has made great strides yet remains hobbled by a resilient Taliban insurgency and fears of a return to civil war.

In many parts of the country, women have more opportunities, schools have opened and nascent governmental institutions are functioning. After five years of oppressive Taliban rule, people are allowed to express their views in public.

“This is one of his greatest legacies. We are here and we can say whatever we want and we can say it to him,” said Saima Khogyani, one of 69 women lawmakers in parliament. “Whether he does what we ask is something else, but he listens.”

But widespread corruption, poor governance and stubborn poverty foster support for the Taliban, who control vast rural sections of southern and eastern Afghanistan. The militants have not only shown little interest in peace but have stepped up attacks aimed at disrupting the elections.

Critics fault Karzai for employing former warlords linked to massive abuses. Karzai’s defenders say he was hamstrung because the U.S.-led coalition enlisted those warlords to fight the Taliban, empowering them.

Many remember the Karzai of the 1980s, when he lived in Pakistan as the former Soviet Union bombed his homeland, napalm laying waste to the countryside. He would talk of the Afghanistan of his childhood — ruby red pomegranate orchards as far as the eye could see, tribal elders passing through his family home outside the southern city of Kandahar, his father, a Popalzai tribal elder, dispensing wisdom and making decisions with a single sweep of his hand.

“What he understood as democracy was what his father practiced in Kandahar, traditional [ethnic] Pashtun back and forth, [use of] jirgas,” as a tool of governance, said Afghan journalist Ahmad Rashid. “I think it is his memories of his father and his past and how ruling and governing was done in the ’60s when he was a child that has had just a huge impact on him.”

Shortly after the Taliban seized power in Kabul in 1996, Karzai became a matchmaker of sorts, shuttling between Afghanistan’s disparate anti-Taliban groups trying to unite them under a single umbrella.

After the U.S.-led invasion in late 2001, Karzai led a small band of men into southern Afghanistan to take on the Taliban regime. The Taliban eventually surrendered not to the Americans but to Karzai, seeking his guarantees of safe passage.

Karzai was still in the mountains in Uruzgan province when he was reached by satellite telephone and told that his lifelong dream would come true: He would be the president of Afghanistan. He was to head a government cobbled together in Bonn, Germany, a collection of warlords-turned-politicians who brought with them their weapons and their militias.

Afghanistan, which was a monarchy until 1973, has had other heads of state. None has been democratically elected.