Through close contacts with the adjacent Arabian Peninsula for more than 1,000 years, the Somali and Afar ethnic groups in the region became among the first populations on the continent to embrace Islam. The Ifat Sultanate was a Muslim medieval kingdom in the Horn of Africa. Founded in 1285 by the Walashma dynasty, it was centered in Zeila. Ifat established bases in Djibouti and Somaliland, and from there expanded southward to the Ahmar Mountains. Its Sultan Umar Walashma (or his son Ali, according to another source) is recorded as having conquered the Sultanate of Shewa in 1285. Taddesse Tamrat explains Sultan Umar's military expedition as an effort to consolidate the Muslim territories in the Horn, in much the same way as Emperor Yekuno Amlak was attempting to unite the Christian territories in the highlands during the same period. These two states inevitably came into conflict over Shewa and territories further south. A lengthy war ensued, but the Muslim sultanates of the time were not strongly unified. Ifat was finally defeated by Emperor Amda Seyon I of Ethiopia in 1332, and withdrew from Shewa.