Canada's soldiers leave the battlefields of Afghanistan with drumbeats of war still ringing in their ears, but when the official presence of the Canadian aid team in Kandahar ended, it barely made a sound.

After sweating away years of effort and millions of dollars trying to rebuild Afghanistan, staff with the Canadian International Development Agency seemed to want no fanfare when the Maple Leaf stopped flying over their base in Kandahar city last month.

Asked why it was such a covert affair, officials sloughed it off as a communications error.

But the missed opportunity is a fitting end to an aid program that leaves behind an uncertain legacy, one the Canadian government has struggled to explain, plan, execute and promote almost from its inception.

From the slums of Kabul to the lush mountains of Herat, some $1.7 billion in Canadian aid has been disbursed in Afghanistan since 2002, when Canada became part of a multinational defence, development and diplomacy effort in a country tossed upside down by decades of war.

Some elements of the program were created to fit into classic counter-insurgency strategy: the military force would clear an area of enemies, hold it with the support of local governments and then funds would start flowing for rebuilding.

At first, the lion's share of Canada's funding went to agencies like the World Bank and the UN, which were funnelling the money to the Afghan government for national programs designed to increase the capacity of local authorities to deliver services, and in turn win the support of the people.

Some programs were runaway successes, like the National Solidarity Program, which created small village-focused councils and gave them the power and funds to decide what kind of projects they needed.

Some were failures, like the Afghanistan Stabilization Program, which was supposed to build up governments outside urban centres.

Results there were so poor that CIDA yanked its $12 million grant.

Canada was also working directly with non-governmental organizations like CARE Canada.

"I am an optimist and we always are probably guilty of believing we can achieve more than a pessimist would agree to, but the individuals were all there with their eyes wide open and felt that there was a tremendous spirit of collaboration," said Kevin McCourt, president and chief executive officer of CARE, of the early days of aid work in Afghanistan.

But the challenges were legion, among them the dangers of operating in a war zone and the dearth of capacity within Afghan civil society.

Back in Ottawa, the bureaucrats were also wrangling with the file.

For example, while CIDA had budgeted money for Afghanistan, it wasn't telling its own task force in charge of the program how much they had to spend.

"CIDA, including the Afghanistan Task Force, does not have a clear and documented process for the preparation of the budget for development assistance," reads an internal government audit quietly posted on the agency's website.

The task force also couldn't account for how it decided how much money to dole out to the World Bank in 2006-2007 and in 2007-2008.

The Canadians also couldn't be sure the money was going where they wanted. The audit found instances of the World Bank redirecting Canadian funds into general pools when Canada had asked it to be spent on specific targets.

Nipa Banerjee, who ran CIDA's efforts in Afghanistan from 2003-2006, said her days were marked by a lot of money flowing out with little sense of how it was actually making a difference.

Direct questions to Afghan officials would come back unanswered and multilateral agencies hadn't yet set up robust accounting mechanisms.

"There were different things happening in the country that looked positive, but there were things brewing in the background," she said.

One of them was a worsening security scenario. The clear-hold-build strategy wasn't working and areas were rapidly becoming inaccessible to aid workers.

Meanwhile, the Harper government decided to centralize control over the mission within the Privy Council office, in an attempt to be able to better oversee its cross-departmental nature and the stories being told about it from the ground.

But it added another layer of complexity to an already complex process. Decisions that use to be made quickly on the ground now had to get signed off on by Ottawa.

"The leadership was Foreign Affairs and to some extent army," said Banerjee.

"CIDA was a secondary factor."

Though the military had been zeroed in on Kandahar since in 2006, civil servants pressed the government to keep its aid focus on national programs.

"To the extent that Kandahar programming is driven by short-term objectives, there is significant risk that they will ill serve longer-term development objectives," reads a 2007 review of the Afghanistan program obtained under the Access to Information Act.

"There is little point in winning the battle if it means losing the war."

But it was the battle Canada decided to focus on.

A blue-ribbon panel led by former foreign minister John Manley suggested clearly "Canadian" projects with a focus on Kandahar and so, in 2008, the government changed course, earmarking 50 per cent of its aid budget for Kandahar-specific programs.

But where the Afghans were asking for stable electricity sources, paved roads and jobs, the Canadian government chose getting 50 schools in working order, rehabilitating the Dahla Dam and vaccinating millions of children against polio as its signature projects.

They were programs that appealed to Canadian sensibilities of what international aid should look like, though the Canadian government maintains they were selected at the request of Afghans.

According to the 2007 review report, some Afghan officials were telling Canadians "please, no more money for Kandahar," arguing that it was forcing them to cut spending in areas where the money could make a real difference in keeping existing programs going.

The government insists the efforts over the last few years have yielded tangible results for Kandaharis and all Afghans.

Quarterly reports provide reams of statistics on teachers trained, canals cleaned and vaccines administered. Officials often argue that these good works are overshadowed by media coverage focused on the military.

"There is a lasting legacy that Canadians can be proud of and I think we all hopefully one day see an Afghanistan that is providing a bright future and a good quality of life for all Afghans," said Minister of International Co-operation Bev Oda.

A investigation earlier this year by The Canadian Press found that schools in Kandahar that were built or renovated on the Canadian government's dime have far fewer students than official enrolment numbers suggest. At the time, Canadian officials refused to give reporters a list or locations of the signature schools.

Monitoring has been beefed up, officials in Kandahar recently suggested, and the school program is on track. According to the Canadian government, 41 of the 50 schools are now complete.

But whether those buildings will still be standing five years down the road is uncertain.

It appears no formal monitoring program is in place to check-in on projects completed under Canada's watch. Both Oda and government officials in Kandahar were vague when asked how they'll be keeping an eye on things, suggesting it will be up to the Canadian embassy in Kabul and Afghan authorities to keep Canadians abreast of ongoing progress.

Oda said she believes the schools will stand the test of time because they were built with the support of communities. The fact that Canada is two years past its deadline to eradicate polio was explained away by the migratory nature of the disease, but the vaccine program has always operated in fits and starts because of security. It's further complicated by the fact that multiple doses of the vaccine are required to ensure proper immunization.

In the end, Canada's true legacy in Afghanistan will likely rest with the Dahla Dam.

Work continues on the physical aspects of rehabilitating the dam, which will help irrigate thousands of hectares of field allowing farmers access to better crops.

There is also a focused effort to make sure that Afghans have the know-how to operate the complex water system on their own.

"I think that a lot has already been done to make sure that when the project is completed at the end of this year that the people who need to have the knowledge to maintain the system," said Claude Desilets, the project supervisor, in a recent interview in Kandahar.

"Are there challenges? There are."

With the end of the combat mission in Kandahar, Canada's aid budget to the country has now been halved to about $100 million a year. Efforts will be centred out of Kabul and funding will return to multilateral agencies for national programs focused on education, health, regional diplomacy and humanitarian assistance.

The change shouldn't be read as Canada backing away, suggested CARE's McCourt.

As long as Canada maintains its commitments to the new funding channels it is setting up, it's just a switch in tactic, he said.

"But if all the levers that are possible for us to use are withdrawn or diminished to symbolic levels, then yes, there will be a sense that this was too hard, we don't have the staying power for it, it's beyond our reach," he said.

"That's not entirely unreasonable."

While CARE prides itself on outlasting government efforts, even it has given up on countries before because the security situation has become too hostile.

But they've also been able to happily close-up shop on countries where the job is considered done.

"We certainly don't expect Afghanistan is going to be one of them," said McCourt.

"We're anticipating being there for quite some time to come."