But getting Daniel Menard out of custody may still take a few days because the order must be approved by two other officials in the government of President Hamid Karzai, said a senior official with the private security firm GardaWorld.
Menard, who left the Canadian military in disgrace, has been employed as the company's managing director for Afghanistan since November 2011.
The paperwork for his release, handed directly to Menard on Thursday night, is being held up by the fact that government offices are closed on Fridays in Kabul, said the official, who spoke on condition of anonymity because he was not authorized to speak to the media.
Menard was detained Jan. 12 following a meeting at the ministry office in Kabul.
Officials at GardaWorld insist that he was not arrested, and that the detention relates to a misunderstanding over the company's operating license.
There was no gun smuggling involved and all of the weapons in question were registered and approved, officials said.
The Afghan government has fought a long-running battle to regulate the activities of private security companies, which used to guard diplomatic missions and aid projects.
At one point in 2010, Karzai banned all foreign contractors, saying they undermined efforts to build a local police force. An agreement was later struck which allowed a limited number of security firms to remain, but to phase out their work.
Menard had been the general commanding Canadian and American troops in Kandahar when he was relieved after revelations surfaced that he was having an affair with a subordinate.
He was later convicted by a military court of fraternization, a serious charge for those in uniform. Menard was also convicted of trying to mislead investigators when he tried to convince Master Cpl. Bianka Langlois to lie about their affair.
He was fined $7,000 and demoted.
Jean-Bruno Villeneuve, a spokesman for Foreign Affairs, would only say Thursday that "consular services are being provided to a Canadian citizen detained in Afghanistan." Villeneuve refused to confirm if the citizen was Menard or provide further comment.