Mali's constitutional court on Friday declared Assimi Goita, the colonel who led a military coup this week while serving as vice president, to be the new interim president.
The ruling raises the stakes as West African leaders prepare to meet on Sunday to respond to the takeover, which has jeopardised a transition back to democracy and could undermine a regional fight against Islamist militants.
Goita became interim vice president after leading the coup last August that overthrew President Ibrahim Boubacar Keita. He ordered the arrests on Monday of President Bah Ndaw and Prime Minister Moctar Ouane.
Both resigned on Wednesday while still in detention. They were later released.
The court said in its ruling that Goita should fill the vacancy left by Ndaw's resignation "to lead the transition process to its conclusion" and carry the title of "president of the transition, head of state".
The ruling set Mali on a collision course with the 15-member Economic Community of West African States (ECOWAS), which has insisted that the transition, which is due to end with elections in February, remain civilian-led.
After agreeing in October to lift sanctions imposed after the coup against Keita, ECOWAS said in a declaration that the vice president of the transition "cannot under any circumstances replace the president."
ECOWAS heads of state are due to meet in Ghana on Sunday.
They and Western powers including France and the United States fear the political crisis could exacerbate instability in northern and central Mali, a home base for regional affiliates of al Qaeda and Islamic State.
Goita, a 38-year-old special forces commander, was one of several colonels who led the coup against Keita. He ousted Ndaw after the interim president named a new cabinet that stripped two of the other coup leaders of their ministerial posts.
Late on Friday, Goita said on national television that he would name a new prime minister from among the members of the M5-RFP coalition, which led protests against Keita last year and fell out with Ndaw and Ouane during the transition.
Jeamille Bitar, a member of the coalition, said its pick for the post would be Choguel Maiga, a former government minister.