Somalia's President Mohamed Abdullahi "Farmajo" has picked a new spy chief days after the prime minister appointed a different person for the job.
The move further deepens the row between the president and the prime minister.
Prime Minister Mohamed Roble sacked the intelligence head Fahad Yasin after defying his order to give a comprehensive report on a missing female spy agent within 48 hours.
The president said the prime minister had no authority to sack the intelligence chief and reinstated him.
President Farmajo has now appointed Yasin Abdullahi Mohamed as the acting spy chief.
The former intelligence head has been named the president's security adviser.
The is is not the first time the president and the prime minister have differed in public.
In August, the prime minister travelled to Kenya and signed bilateral agreements despite the president's ban on agreements with foreign entities until after elections.