In June 1960 Egal was Prime minister of the newly independent State of Somaliland, which merged five days later with the former Italian Trust Territory to form Somalia. He served as Somalia's defense minister (1960–1962), Education Minister (1962–1963), Prime minister (1967–1969), and ambassador to India (1976–1978), although he was imprisoned twice under Barre dictatorship. When the Somali Republic collapsed in 1991, Somaliland unilaterally declared a resumption of its independent status; although he initially opposed its secession, two years later Egal was elected president by a council of Elders.
Egal managed to disarm rebel groups, stabilized the north western region and economy of Somaliland, successfully managed to establish bilateral trade with foreign countries, introduce Somaliland new currency the Somaliland shilling, as well as the Somaliland passport and Somaliland national flag and creating the most successful and powerful armed police and military force in Somalia.
Egal died in Pretoria, South Africa while undergoing surgery at a military hospital. His three sons laid him to rest next to his father in accordance with his last wishes. He was buried at the port city of Berbera. He was given a state funeral in which around 4,000 Somalilanders mourned and attended the service. Dahir Riyale Kahin was inaugurated as the new leader after Egal's death. During which, the parliament declared seven days of mourning, however the flags were not flying at half-mast because the emblem includes the Shahadah, Islam's holiest words.