One of the keys to the success of modern and ancient reef ecosystems is the phenomenon of photosymbiosis. Photosymbiotic corals can thrive down to the limits of the photic zone, and the coral communities living in the lower part of the photic zone are known as mesophotic coral reef ecosystems (MCE). Recent studies have shown that MCEs were already present in the middle Palaeozoic. The reefs of that time reached the peak of their distribution during the Givetian, when they were present even as far as 50°S. One of the southernmost Givetian reefs is the Aferdou el Mrakib reef, exposed in the eastern Anti-Atlas (Morocco). At the base of this reef, numerous small carbonate bioherms are exposed. These structures formed low-relief banks that developed probably at moderate water depths of several tens of meters. In the present contribution, we analyse the paleoecology of these peculiar communities. The assemblage is dominated by platy and encrusting coenitid (Roseoporella) and alveolitid (Alveolites) tabulate corals, as well as abundant platy stromatoporoids and solitary cystyphillid rugose corals. The platy morphology of corals is widely considered as an adaptation related to photosymbiosis, and is especially common in MCEs. In combination with palaeobathymetric and sedimentological data, this characteristic suggests that the studied banks developed at the bottom of the euphotic zone. The MCEs of the Aferdou el Mrakib reef share major taxonomic and ecological similarities with the previously described MCEs from the southern shelf of Laurussia and a reef community from southern China, emphasizing a high degree of cosmopolitanism of the Middle Devonian mesophotic ecosystems. Communities studied here are also the most poleward MCEs described to date.