An Indian and two Britons were on Wednesday convicted by an Afghan court on gun smuggling charges.
The court gave them two-year suspended sentences following a one-day trial.
Naveen Joshi from India and the Britons -- Peter Eaton and Mike Shaw were jailed since October 13.
They, along with Sargon Heinrich of California, were arrested from a Kabul guesthouse during a police raid.
Prosecutors said they were involved in a deal to sell 100 guns to an undercover police officer who posed as a buyer.
The men denied the charges and said they were treated roughly during the raid. Joshi claimed police beat him into giving a confession and threatened to shoot him.
The chief judge in the case, Anasarullah Mawlawy Zada, said the three-judge panel decided that Eaton, Shaw and Joshi will be given two-year suspended sentences, meaning they would be released after providing guarantees that they will return to court if the case is appealed -- as the prosecutor vowed.
Heinrich was ordered released subject to the same guarantee.
Joshi, 33, of Mumbai, told the judge he was tortured into signing a statement implicating himself and Eaton.
He later retracted the statement.
Zada gave no reason for the rulings.
The prosecutor, Haji Balol, told the court that police had found five Kalashnikov rifles and two pistols at the guesthouse, where Heinrich and Eaton were staying.
He claimed Joshi had provided an undercover police officer with a sample gun as part of the alleged deal.