Diarra's arrest and subsequent resignation on Tuesday will complicate efforts to stabilise Mali, where soldiers and politicians remain divided since a coup in March and where the north of the country is occupied by al Qaeda-linked radical fighters.
"I, Cheick Modibo Diarra, hereby resign with my entire government on Tuesday, December 11 2012," a nervous-looking Diarra said in a statement broadcast on state television early on Tuesday morning.
News of Diarra's resignation came hours after he was arrested as he tried to leave the country for France.
Bakary Mariko, a spokesperson for the group of soldiers that seized power in a March coup and remains powerful despite officially handing power back to civilians in April, said Diarra had been arrested for not working fully to address the nation's problems.
"The country is in crisis but he was blocking the institutions," Mariko said. "This is not a coup. The president is still in place but the prime minister was no longer working in the interests of the country."
Mariko said Diarra had been taken to the ex-junta's headquarters in Kati, a military barracks town just outside Bamako, after his arrest.
Coup leader Captain Amadou Sanogo has been repeatedly accused of meddling in politics since he stepped down and was officially tasked with overseeing reforms of Mali's army.
Residents in Bamako said the town was quiet in the early hours of Tuesday morning.
There have been divisions for months between the former junta, interim President Diouncounda Traore and Diarra, a former Nasa scientist and Microsoft chief for Africa.
Diarra was made prime minister in April after the military officially handed power back to civilians. As the son-in-law of Moussa Traore, a former Malian coup leader and president, he appeared to have good ties with the military.
But tensions became particularly acute in recent weeks, with analysts saying Diarra, a relative newcomer to Mali's politics after years abroad, seemed keen to establish a political base of his own ahead of any future elections.
West African leaders and Western nations have warned that Mali's north has become a safe haven for terrorism and organised crime, but they have struggled to draw up plans to help the country because of the deep divisions in the capital.
Some of Mali's politicians support the idea of a foreign-backed military operation to retake control of the north. Others, including much of the military, say they need only financial and logistical support and insist that Mali can carry out the operation itself. – Reuters