The European hake, Merluccius merluccius (Linnaeus, 1758), is one of the most important resources for Mediterranean fisheries. Due to its pivotal role in energy transfer from lower to higher trophic levels, this species is a crucial component of the ecosystem’s functioning. The ecological role of Merluccius merluccius, off the Moroccan Mediterranean Sea (southern Alboran Sea), was investigated, exploring seasonal and ontogenetic shifts, geographical variations in prey composition, and feeding strategy. Between November 2020 and July 2022, a total of 402 hake specimens were collected by oceanographic bottom trawl surveys (MEDITS) that were carried out during warm and cold seasons to assess their diet and feeding habits. The sample was analyzed according to fish sizes and seasons, and qualitative/quantitative feeding indices were calculated. The trophic spectrum of Merluccius merluccius included 24 prey items in total, mainly belonging to Osteichthyes (12), Crustacea (10), Cephalopoda (1), and Polychaeta (1), suggesting a generalist behavior of this predator as in numerous regions of the Mediterranean Sea, with several species that occasionally occurs in its diet. In the Moroccan Mediterranean Sea, Osteichthyes proved to be the most important prey item (%IRI = 78.56) among the different zoological groups, followed by Crustacea (%IRI = 16.22). The other food items were occasionally and randomly consumed, and cannibalism was low (0.8%). Hierarchical cluster analysis and nonmetric multidimensional scaling (nMDS) showed different feeding habits of two main groups separated at 60% similarity: small specimens <10 cm TL, primarily feed on zooplanktonic prey, while medium and large specimens hold a diet based on Osteichthyes with crustaceans. Furthermore, a significant positive relationship between hake and fish prey size was confirmed. Seasonally, mesopelagic Osteichthyes were the main food prey in the summer season, while pelagic species were predominant during the autumn. SIMPER analysis revealed that the prey items contributing the most to the differences between seasons and length classes were Engraulis encrasicolus, Micromesistius poutassou, Boops boops, Macroramphosus scolopax, gobids, Gadiculus argenteus, and most of Crustacea. The diet does not appear to be influenced by sex (>0.05). A trophic level (TROPH) of 4.1 was calculated, indicating that the species is a top predator (quaternary consumers). The TROPH values ranged between 2.58 and 4.38 from juveniles to adults, increasing asymptotically with the size of specimens. In contrast to what has previously been found in other Mediterranean regions, where ichthyophagous hake feed mostly on pelagic Osteichthyes, such as Engraulis encrasicolus, Sardina pilchardus, and Micromesistius poutassou, the study points up the vital role played by Atlantic horse mackerel Trachurus trachurus for hake diet in the Moroccan Mediterranean Sea. Information on the feeding ecology of fish species as provided in this study is essential to improve ecosystem conservation in accordance with multispecies approach to fishery management, leading to a better understanding of the role of hake in the Moroccan Mediterranean Sea demersal communities.