Canada's 12-year-long military mission in Afghanistan has come to an end, but the Maple Leaf will continue to fly over the embattled country. It was time for the soldiers to come home, but Canada itself cannot abandon Afghanistan, which is still politically and economically fragile. Rival warlords, ethnic tensions, religious extremists and widespread poverty are constant threats and the country could easily revert to civil war and violent chaos.
It's tempting to say Canada has done its bit for a hopeless cause, but it's not that easy. As a member of the international coalition that turned the country upside down and inside out, killed, injured or displaced thousands of civilians and encouraged Afghans to risk their lives for western security interests, Canada cannot now turn its back.
The Harper government has committed $300 million in development assistance over the next three years. Canada, however, should be prepared to dig deeper to meet its continuing moral obligations to the people of Afghanistan.
The immediate challenge is to ensure the presidential election next month is fair, transparent and free of violence. It will be Afghanistan's first democratic transfer of power and a test of the country's security forces.
The Taliban insurgency is threatening to kill anyone who goes near a voting booth, but Afghans have demonstrated their bravery in the face of such threats in the past.
Some observers say it is too early to measure Canada's legacy in Afghanistan, and that the ultimate judgment will depend on whether the country remains relatively stable, or descends into chaos and anarchy.
Canada joined the U.S.-led coalition in Afghanistan following the devastating attacks of 9/11 that killed nearly 3,000 people, including 24 Canadians. Those assaults were organized by the terrorist network al-Qaida, which was given sanctuary in Afghanistan, where it was able to train terrorists and plot attacks with impunity.
At the time, no one knew where the next attack might come, but they knew the enemy was in Afghanistan, protected and nourished by the extremist and oppressive Taliban government.
The military goal was both necessary and simple: Eliminate the threat and deny safe harbour to al-Qaida and its fellow travellers.
A secondary goal was to stabilize Afghanistan so it would not be used again as a launching pad for terrorism.
The country could still deteriorate, particularly if the new president cannot reach a long-term security agreement with the United States, which still has 40,000 troops in the country, but the point is Afghanistan is no longer an international headquarters for al-Qaida and other terrorist organizations.
In a country with a history of violence, the measure of success is not the absence of violence. Afghanistan will be a dangerous place for many years, not unlike many troubled countries in the world.
Canada's military leaves Afghanistan with its head high. The mission had a shaky start in 2002, when the troops arrived in green camouflage and without all the equipment they needed.
In time, however, Canadian troops were among the most respected in Afghanistan. They performed well under difficult conditions, earned the trust of local Afghans and the confidence of coalition partners. By 2010, a Canadian general was even commanding American forces, a rare honour.
They are not leaving behind a clear victory, but it was never reasonable to expect one. The military's job was to disrupt terrorists and give Afghans a chance to succeed.
Those missions are ongoing, but Canada's men and women in uniform did their part in a difficult, but necessary, campaign that cost the lives of 158 soldiers and injured thousands more.
It's the end of an era for the military, and a new chapter in Canadian history.