The soldiers' arrest sparked a diplomatic dispute between Mali and neighbouring Ivory Coast, and widespread condemnation from regional leaders against a country already at odds with the international community.

They were arrested at the airport in Mali's capital Bamako last July. Malian authorities said the troops were acting as mercenaries, while Ivory Coast said they were part of a United Nations peacekeeping mission in Mali.

Three who were women were later released, while the remaining 46 were sentenced to 20 years imprisonment on Dec. 30 for attempting to undermine state security. The three released women were sentenced to death in absentia.

President Assimi Goita "granted pardon and fully revoked the sentences of the 49 Ivorian (soldiers)," government spokesman Abdoulaye Maiga said in a statement.

"This gesture demonstrates once again (Goita's) attachment to peace, dialogue and pan-Africanism," it said.

The statement described the move as an "independent decision" symbolising the president's commitment to good governance and "preserving fraternal relations" with countries in the region, particularly Ivory Coast. It did not specify when the soldiers would leave prison.

Ivory Coast's government was not immediately available for comment. It has previously said its troops were being held hostage, and made repeated pleas for their release.

Mali has grown increasingly isolated since military officers toppled the government in 2020 and failed on election promises, prompting sanctions from West Africa's main political and economic bloc ECOWAS.

Several countries, including Ivory Coast, have decided to withdraw troops sent to help fight a decade-old insurgency in Mali this year due to the junta's collaboration with Russian mercenaries.

ECOWAS, towards which Mali's government has grown increasingly hostile, had threatened to impose more sanctions on the country if the soldiers were not freed.

Togo's President Faure Gnassingbe, who was mediating the crisis, met Goita in Bamako on Thursday before heading to Ivory Coast.

(Reporting by Tiemoko Diallo; Additional reporting by Loucoumane Coulibaly in Abidjan; Writing by Sofia Christensen; Editing by Leslie Adler, Josie Kao and Sandra Maler)