Beja people
Following the fall of Axum in the 8th century, the area around Massawa and the town itself fell under the occupation of the Umayyad Caliphate from 702 to 750 CE. The Beja people would also come to rule within Massawa during the Bajag Kingdom of Eritrea from the year 740 to the 14th century. Massawa was situated between the sultanates of Qata, Baqulin, and Dahlak. Midri-Bahri, an Eritrean kingdom (14th–19th centuries), gained leverage at various times and ruled over Massawa. The port city would also come under control of the Balaw people during the Balaw Kingdom of Eritrea (12th–15th centuries). At this time, the "Sheikh Hanafi Mosque", one of the country's oldest mosques, was built on Massawa Island. The city reportedly has the oldest mosque in Africa, that is the Mosque of the Companions. It was reportedly built by companions of Muhammad who escaped persecution by Meccans.