In 1969, a few days after the assassination of Somalia's second president Abdirashid Ali Sharmarke, a military junta led by Major General Mohamed Siad Barre staged a bloodless coup d'état. Aidid at the time was serving as Army Commander of the 26th Division based in Hargeisa. He was also the Head of Operations for the Central Regions and Northern Regions of Somalia. However he was relieved of his duties and soon after was recalled to Mogadishu to lead the troops guarding the burial of the deceased President. He quickly fell out of favour with the new regime's leaders and was subsequently detained along with Abdullahi Yusuf Ahmed. Aidid was eventually released from prison six years afterwards to take part in the 1977–78 war against Ethiopia over the disputed Ogaden region.