Bolivia has agreed to pay a fine of US$50,000 paving the way for the release of nine of its nationals following an acrimonious legal battle with Chile.
The men, two military and seven customs officials, were detained in a border region on March 19.
They were accused of smuggling, theft with intimidation and illegal possession of weapons.
Bolivia has rejected the claims, insisting that Chilean police crossed into its territory and detained the officers while they were performing a regular operation against smuggling.
The detainees are expected to return to Bolivia within the coming days. The Bolivian Justice Minister said "Let's hope that between Tuesday and Wednesday the nine compatriots are finally in Bolivian territory".
Last week a Chilean judge ruled that they would be expelled from the country within 30 days once the money had been paid.
President Evo Morales has confirmed the signing of a supreme decree to provide the funding for the fine.
Morales maintains the men's detention was illegal and promised to give them back their dignity:
100 días de la detención abusiva, arbitraria e ilegal de 9 hermanos en Chile.Con justicia y verdad repararemos su dignidad #Los9SonInocentes— Evo Morales Ayma (@evoespueblo) June 27, 2017
After the fine is processed, the detainees will be transported to the Bolivian border.
Bolivia's Attorney General, Pablo Manacho, said the transfer will be handled judicially through consular authorities and the Ministry of Justice.
The dispute went as far as the Organization of American States.
The Bolivian Foreign Minister Fernando Huanacuni told the OAS General Assembly that the men's detention was “unjust and arbitrary”.
Chilean Foreign Minister Heraldo Muñoz responding by saying that “he does not accept that an internal legal situation in his country should being vented at the OAS” and warned that “the precedent that can be created with this case is interminable.”