After the 1966 Nigerian coup d'état, Shagari was among the government officials who handed over government to the military leadership of Maj. Gen. Aguiyi Ironsi. He returned to Sokoto to promote education. He served as the Executive Secretary of the Sokoto Province Education Development Fund in 1967, where he built many provincial schools. He was later appointed as Commissioner of Establishment and Training and also served briefly as Commissioner for Education in the defunct North Western States before he was invited to serve under the Federal Military Government of Gen. Yakubu Gowon.