Interim President Bah Ndaw and Prime Minister Moctar Ouane were detained at a military base in Kati outside the Mali capital, Bamako, on Monday.
Mali's ousted interim president and the prime minister have been released, a military official said, three days after both men were arrested and made to resign in the nation's second second coup in nine months.
They were freed at around 1 a.m. local time on Thursday, the BBC reported.
"We were true to our word," a military official was quoted as saying by AFP news agency.
Interim President Bah Ndaw and Prime Minister Moctar Ouane were taken to a military base in Kati outside the capital, Bamako, on Monday after a cabinet shakeup in which two officers were replaced.
Before their arrests, the duo were overseeing a transitional government tasked to hold elections by February next year.
Miffed by the reshuffle, Vice President Assimi Goïta, a colonel, who led the coup on Monday, said he should have been contacted before the announcement was made.
He accused them of sabotage and said the election billed for 2022 will go on as planned.
Mr Goïta also led the coup that ousted former President Keita in August.
While being held, Messrs Ndaw and Ouane were stripped of their positions after which they resigned on Wednesday.
Foreign leaders including Nigeria, ECOWAS, the AU and the UN have condemned the putsch. Others like France have vowed to sanction the coup promoters.
A team of negotiators delegated by the international organisations arrived the West African country on Wednesday to broker the release of the detained leaders.