Introduction

In Saharan, arid and semi-arid areas, population growth, over-exploitation, expansion of agricultural activities, and global warming pose serious problems for groundwater quality (Edmunds 2009; Ouhamdouch et al. 2016, 2018; Zuppi 2008). Therefore, water scarcity is a very sensitive issue in these areas, where degradation of groundwater quality also threatens the natural conditions of aquifers, including coastal aquifers, and the associated well-being of local populations and natural ecosystems.

In this respect, natural processes and anthropogenic activities could have serious effects on groundwater quality and further limit their use for drinking water supply and for irrigation purposes. Groundwater quality degradation as a result of human activities could be manifested by the decrease in water level due to over-exploitation leading to salinization often related to the dissolution of evaporite minerals and the intrusion of seawater (Bahir et al. 2018b; Kammoun et al. 2018; Ouhamdouch et al. 2017; Trabelsi et al. 2005), by the pollution following the return of irrigation water to the aquifer, and the lack of adequate control of wastewater and waste disposal (Carreira et al. 2018; Kammoun et al. 2018; Trabelsi et al. 2012; Zuppi 2008). The natural processes effect on groundwater quality can be manifested by, for example, mineral leakage in the rock formation during the dissolution of halite or gypsum (Bahir et al. 2018c; Abid et al. 2014). The combined effect of these phenomena results in an increase in the groundwater mineralization and, consequently, water quality degradation (Re and Zuppi 2011).

However, it is important to identify the mechanisms responsible for the groundwater quality degradation to better manage and protect this vital resource (Re et al. 2014; Zuppi 2008).

In this context, this study attempts to highlight the mechanisms that dominate the groundwater mineralization of the shallow detrital aquifer of Essaouira basin and to evaluate their quality for drinking and irrigation purposes based on GIS, the hydrogeochemical, isotopic, and geostatistical approaches.

Site description

The Essaouira basin is one of the most important basins of Morocco; it contains 10% of the total aquifer at the national level (8 aquifers out of 80). The aquifer taken as an example in this investigation is the Plio-Quaternary aquifer of Essaouira basin. This aquifer is located between latitude 31° 24′ and 31° 49′ N, longitude 9° 52′ and 9° 85′ W.

The study area is limited to the West by the Atlantic Ocean, to the north by Ksob Wadi, to the East by the Triassic salt formations, and to the south by Tidzi Wadi (Fig. 1). The climate characterizing this zone is of semi-arid type with two seasons: a wet season runs from November to March and a dry season runs from April to October. Annual rainfall does not exceed 300 mm and temperatures fluctuate around 20 °C (Ouhamdouch and Bahir 2017).

Fig. 1
figure 1

Geographic location, geological map, and cross section of the study area

From the geological point of view, the formations of Essaouira basin have an age ranging from Triassic to Quaternary. Outcrops of the Triassic (saliferous red clays) and Jurassic (alternation of carbonate and marly deposits) are limited and rich in halite and gypsum or anhydrite (Fig. 1) (Peratsmen 1985; Clément and Holser 1988; Peybernes et al. 1987). According to Duffaud et al. (1966), the lower Cretaceous is composed of limestones and marls alternating with some layers of sandstone. The mid-Cretaceous is marked by the sandstone of Aptian, followed by green marl of Albian age. As for the Cenomanian, it is represented by marls rich in anhydrites. These Cretaceous age units are exposed in the eastern part of the Plio-Quaternary aquifer and Barremo-Aptian, while the Upper Cretaceous is represented by dolomitic marls and limestones. It is overlain by a gypsiferous and siliceous gray marl of Senonian age which represents the base of the Plio-Quaternary aquifer, the object of this study. The Plio-Quaternary is discordant on all the previous grounds. It consists mainly of sands, sandstones, and conglomerates, with some sections of sandy marl, limestone, and dolomite.

Hydrogeologically, the study area contains two important aquifers; the Plio-Quaternary (shallow) and the Turonian aquifer (deep). In this investigation, we will focus only on the shallow aquifer. These two aquifers are separated by impervious marls of Senonian, and the contact between the aquifers is assured at the edges of the basin (Fig. 2).

Fig. 2
figure 2

Piper diagram showing hydrogeochemical facies of Plio-Quaternary aquifer within Essaouira basin

The shallow aquifer, which is the subject of this study, is housed in sandstone and conglomerate formation of Pliocene-to-Quaternary age with a thickness ranging from 5 to 60 m (Bahir et al. 2000). Geographically, this aquifer is limited to the north and south by Ksob and Tidzi Wadis, respectively. While the Triassic formations (Tidzi diapir) represent the eastern limit and the Atlantic Ocean the western limit. According to Mennani (2001), the results of pumping tests show that this aquifer has a transmissivity range between 4.5 × 10–5 and 6.02 × 10–2 m2/s. The highest values are marked in the northern part of the aquifer (recharge zone), while the low values were noted in the southern part.

Materials and methods

A sampling campaign was organized in April 2018. This campaign was the subject of a collection of 28 samples: one sample of seawater, one sample of rainwater, two samples of surface water, and 24 groundwater samples. The April 1991 campaign was also the subject of 28 samples (Fekri 1993). These water samples were collected in polyethylene bottles of 1 L, and kept in coolers. Measurements of physico-chemical parameters (temperature, pH, electrical conductivity, and TDS) were made in the field using the multi-parameter HI9828. The depth to water in each well was measured using a sound piezometric probe. The concentrations of major cations and anions (Ca, Mg, Na, K, Cl, SO4, and NO3) were determined by liquid chromatography (ILC) in the Laboratory of Radio-Analysis and Environment (LRAE) at the National School of Engineers of Sfax (Tunisia). This equipment was equipped with IC-Pak TM CM/D columns for cations and SUPER-SEP IC columns for anions. The ionic balance is within ± 5%. Total alkalinity (HCO3 and CO3) was determined by titration with HCl (0.1 M). The bromine contents were measured using the device “inoLab pH/Ion level 2”.

Stable isotope levels were measured by laser spectroscopy within the LRAE. The measurements are expressed in per mille compared to the international Standard Mean Ocean Water (SMOW) standard with an analytical uncertainty of ± 0.1‰ for oxygen-18 and ± 1‰ for deuterium.

The saturation indices estimation with respect to the minerals in the analyzed samples was made using the PHREEQC program, version 2.10.0.0 (Parkhurst and Appelo 1999).

Principal component analysis (PCA) has been applied to hydrochemical and isotopic data to highlight the different processes responsible for groundwater mineralization. The statistical processing was carried out using the XLstat software (trial version). Spatial distribution maps have been compiled using the geostatistical and geographic information system (GIS) tool. The data modeling was done by the ordinary kriging method.

Results and discussion

Chemical facies

The study of water chemistry is an essential step for better management and protection of this water resource. To highlight the chemical facies characterizing the shallow Plio-Quaternary aquifer of the Essaouira basin, Piper diagrams are used (Piper 1944).

This diagram has been used by several researchers and has given satisfactory results (Bahir et al. 2018a, b, c; Kammoun et al. 2018; Ouhamdouch et al. 2018). The projection of the April 1991 and April 2018 samples in this diagram is shown in Fig. 2. For the 1991 campaign, 90% of the samples had Na and Cl concentrations greater than 50% (trend towards the Na + K pole in the cation triangle and towards the Cl pole in the anion triangle). This situation gives the samples analyzed in 1991 a facies of the Na–Cl type. As for the companion of 2018, the same situation is kept for chlorides, this time with a percentage of 92% (Fig. 2). While for cations, it is found that the samples are scattered in the central triangle with a slight tendency towards the magnesium pole. This situation gives the waters analyzed in 2018 a facies of mixed Ca–Mg–Cl and Na–Cl type (Fig. 2).

Spatial distribution of salinity

Electrical conductivity (EC) is a very important parameter to have help on the salinity of such water. The measured values for this parameter during the campaign of 1991 vary between 529 and 3055 μS/cm with an average of 1454 μS/cm and a standard deviation of 674 μS/cm. For 2018, the EC values are larger than those measured in 1991, and they vary between 916 and 9744 with an average of 2926 μS/cm and a standard deviation of 1966 μS/cm (Table 1).

Table 1 Summary statistics of physico-chemical of study area

The geostatistical approach using the ordinary kriging technique was applied to map the spatial distribution of salinity (Fig. 3). The shallow aquifer salinity distribution map shows that lower EC values are found in the northern and eastern portions of the study area, due to the possible dilution phenomenon resulting from aquifer recharge in these places. The highest values are measured in the southern part and the western part (towards the Atlantic Ocean). This situation could be explained by the remoteness of the recharge area (by Ksob Wadi in the North and by direct infiltration in the East) of the aquifer and by the marine intrusion phenomenon.

Fig. 3
figure 3

Spatial distribution of salinity within Plio-Quaternary aquifer of Essaouira basin

Hydrochemical processes and origin of salinization

The statistical results of the chemical analyzes are summarized in Table 1. For the 1991 and 2018 campaigns, the most dominant anions are chlorides. While for the cations, the Na and Ca are the most dominant.

Cl contents range from 4.4 to 44.5 meq/L with an average of 18.1 for 1991; and between 2.8 and 89.1 meq/L with an average of 20.1 for 2018, and an excess of 2 meq/L with respect to 1991 (Table 1). As for the Na concentrations, they vary between 5.8 and 29 meq/L with an average of 15.6 meq/L for the 1991 campaign; and between 3.3 and 63.7 meq/L with an average of 13.3 meq/L for 2018, a decrease of 2.3 meq/L with respect to 1991 (Table 1). Ca concentrations are almost the same for both campaigns; they vary between 2.4 and 20 meq/L with an average of 8.4 meq/L for 1991, and between 2.9 and 18.2 meq/L with an average of 7.5 meq/L for 2018. Concerning HCO3 ions, they present mean concentrations of 4.5 meq/L for 1991 and 4.6 meq/L for 2018. While SO4, has a mean concentrations of 2 meq/L in 1991 and 2.5 meq/L in 2018. Nitrate concentrations measured in 2018 range from 0 to 6.4 meq/L with an average of 0.8 meq/L (Table 1).

To highlight the phenomena responsible to groundwater salinization in the study area, the major element correlation diagrams were used.

Correlation diagram Na versus Cl (Fig. 4a) shows a significant positive correlation with a coefficient of determination (R2) equal to 0.71 and 0.97 for 1991 and 2018 campaign, respectively. This reflects that these two ions have the same origin. The majority of the points in the two campaigns are scattered around the line with slope equal to 1 reflecting the halite contribution in the groundwater salinization of the study area. This hypothesis is corroborated by negative saturation indices with respect to halite (Fig. 5). Some points are aligned with the freshwater–seawater line, suggesting the marine effect on groundwater mineralization. Cl excess could be explained by the reverse base exchange phenomenon with the release of Ca and fixation of Na by the aquifer matrix (Fig. 6c). Correlation diagram NO3 versus Cl (Fig. 6a) shows a very weak correlation between these two elements, this confirms that the chlorides are of natural origin and not anthropogenic.

Fig. 4
figure 4

Correlation diagrams: a Na vs Cl, b Ca vs SO4, c Ca vs Mg, d Ca vs HCO3, e Br vs Cl, and f Br/Cl vs Cl

Fig. 5
figure 5

Saturation indices: a 2018 campaign; b 1991 campaign

Fig. 6
figure 6

Correlation diagrams: a NO3 vs Cl, b NO3 vs SO4, and c (Ca + Mg–HCO3–SO4) vs (Na + K–Cl)

The correlation between Ca and SO4 is very modest (Fig. 4b). This makes it possible to exclude the contribution of gypsum and/or anhydrite dissolution in the groundwater mineralization. However, Fig. 5 shows negative saturation indices with respect to gypsum and anhydrite, which negates the exclusion already mentioned and confirms the participation of sulfate minerals dissolution in the mineralization. However, the SO4 deficiency with respect to Ca can be the result of the inverse base exchange phenomenon (Fig. 6c). The correlation diagram NO3 versus SO4 (Fig. 6b) shows a very weak correlation between these two elements, and this confirms that the SO4 is of natural origin and not anthropogenic.

The Ca versus Mg diagram (Fig. 4c) shows a weak correlation between these two elements, suggesting that groundwater in the study area is unable to dissolve the mineral of dolomite. This hypothesis is corroborated by positive saturation indices (Fig. 5). The same situation is noticed for the correlation between Ca and HCO3 (Fig. 4d) (R21991 = 0.09 and R22018 = 0.27). This indicates the inability of groundwater to dissolve calcite due to supersaturation with respect to this mineral (Fig. 5).

Bromine is a very good indicator of the freshwater–seawater mixture (De Montety et al. 2008). The use of the Br/Cl ratio makes it possible to differentiate between salinity of marine origin and non-marine origin (Andreasen and Fleck 1997). Water with a ratio between 1.5 and 1.7‰ is considered impacted by seawater, and water with a low ratio (less than 1.5‰) reflects the contribution of evaporites dissolution in the salinization groundwater (Custodio 1976).

The Br versus Cl diagram (Fig. 4e) shows a very strong positive correlation between these two elements. This suggests that these two ions have the same origin. For this study, 11 samples from the 2018 campaign have known concentration of Br. The Br content ranged from 0.17 to 1.5 meq/L with an average of 0.47 meq/L. On the Br/Cl versus Cl diagram (Fig. 4f), some points are scattered on 1.5–1.7 ‰, indicating the contribution of the marine intrusion to groundwater salinization in the study area. While some other points are grouped in clusters around the Br/Cl ratio equal to 1‰ which confirms the contribution of the saliferous minerals dissolution in the groundwater salinization.

The Gibbs diagram (Gibbs 1970) is one of the diagrams used to highlight phenomena that may be involved in groundwater mineralization, such as water–rock interaction, evaporation, and precipitation. The Gibbs ratios can be calculated as follows:

$${\text{Gibbs ratio for anion}}\;{\text{I}} = \frac{{{\text{Cl}}}}{{{\text{Cl}} + {\text{HCO}}_{3} }}$$
$${\text{Gibbs ratio for cation}}\;{\text{II}} = \frac{{{\text{Na}}}}{{{\text{Na}} + {\text{Ca}}}}.$$

To highlight the phenomena that may occur in the groundwater mineralization of the study area, the calculated ratios are plotted against TDS (Fig. 7). In the study area, I ratio values range from 0.42 to 0.97 with an average of 0.74 for the 2018 campaign, and between 0.47 and 0.94 with an average of 0.75 for the 1991 campaign. As for the ratios II, they vary between 0.46 and 0.81 with an average of 0.60 for the 2018 campaign, and between 0.58 and 0.83 with an average of 0.65 for the 1991 campaign. Figure 7 shows that the two phenomena involved in the groundwater mineralization of the study area are the water–rock interaction and evaporation.

Fig. 7
figure 7

Gibbs diagram: a TDS vs [(Cl/Cl + HCO3)]; b TDS vs [(Na/Na + Ca)]

Stable isotope contribution

The isotopic tool is a complementary tool to determine the groundwater origin, the area, and the recharge mode of the aquifer. Also, it makes it possible to highlight the processes that can affect the water molecule (Geyh 2000). For the study area, the oxygen-18 levels ranged between − 1.83 and − 5.02‰ with an average of − 3.93‰ and the deuterium contents ranged between − 8.92 and 29.71‰ with an average of − 22.82 (Fig. 8).

Fig. 8
figure 8

Correlation diagram a18O vs 2H and b Cl vs 18O of analyzed samples

The oxygen-18 versus deuterium diagram (Fig. 8a), where the Local Meteorological Line (δ2H = 7.55δ18O + 9.2 (Bahir et al. 2000)) and the Global Meteoric Water Line (GMWL) have been positioned, shows that the majority of points are scattered around the GMWL and the LMWL, which means that the current recharge of the Plio-Quaternary aquifer is ensured by the direct infiltration of oceanic precipitation, especially for points close to Ksob Wadi. Some other points are located below GMWL with more enriched isotopic compositions (surface waters, point 13, and 24), reflecting the intervention of other phenomena in groundwater mineralization, such as evaporation and marine effects. Point 13 is located between the "rainwater" pole and the "marine pole", and this suggests the advancement of seawater in the studied aquifer. Some other points, notably surface waters and points 18 and 24, are dominated by evaporation (δ2H = 5.3 δ18O—4.3). This confirms the results obtained by the hydrogeochemical approach by exploiting the Gibbs diagram (Fig. 7).

Also, the combined use of the chloride content and the oxygen-18 content makes it possible to support the results obtained previously. In fact, the Cl versus δ18O diagram (Fig. 8b) shows that the groundwater of the study area is dominated by the following processes: (i) the dissolution of evaporitic minerals previously described, (ii) evaporation, and (iii) marine intrusion.

Groundwater level

The distribution of points where measurements and water samples were taken was imposed by the availability of wells in the field. Wells are quite numerous along the Ksob Wadi, and they become less numerous inside the study area, or even absent in the western zone where the terrain is sandy and, consequently, unfavorable for well digging. This distribution poses the problem of the impossibility to use a regular mesh for the whole sector.

The piezometric map of the shallow aquifer within the Essaouira basin was drawn up based on data of 2018 campaign (Fig. 9). The map shows piezometric contour lines whose altitude varies between 0 and 180 m asl. The groundwater direction is generally from south-east to north-west to join the sea, natural outlet of this aquifer. A watershed divide-oriented SE–NW separates the area into two zones, one north and the other south.

Fig. 9
figure 9

Piezometric map of the Plio-Quaternary shallow aquifer of Essaouira basin: a 2018 campaign and b 1991 campaign

The upstream part has a strong and uniform hydraulic gradient, of the order of 23 ‰, which decreases rapidly from the middle of the study area to 4 ‰ in the north and 11 ‰ in the south. This situation is due to the slope gradient of the substratum on the underground flow.

At the first glance, the comparison of the two piezometric maps of April 1991 and April 2018 shows that the groundwater kept the same direction of flow. However, for the piezometric level, it is not the case. The comparison of the piezometric level of certain points measured in April 1991 and in April 2018 (Table 2) shows a downward trend with a decline of about 3.26 m (means of deviations). This situation could be related to the decrease in rainfall and confirms the results obtained by Ouhamdouch et al. (2018) by assessing the impact of climate change on the water resources within Essaouira basin.

Table 2 Piezometric variation (in m asl) within the Plio-Quaternary aquifer between 1991 and 2018

Statistical analysis

The correlation matrix (Table 3) of the nine variables (Ca, Mg, Na, Cl, SO4, NO3, EC, δ18O, and δ2H) indicates that: (1) the high correlation between the chemical elements and EC (r2 > 0.80) reflects the participation of these elements in the groundwater mineralization of the study area; (2) the strong positive correlation between Na and Cl (r2 = 0.98) indicates the contribution of halite dissolution in the mineralization and confirms the results obtained by the hydrogeochemical approach; (3) the strong positive correlation between Ca and SO4 indicates the contribution of sulfate mineral dissolution in groundwater salinization, which corroborates the results obtained by the hydrogeochemical approach; (4) the lack of a significant correlation between NO3 and other elements reflects that nitrates come from a source other than agricultural activity, and this source could be waste from livestock during watering and septic tanks.

Table 3 Correlation matrix of chemical and isotopic parameters

Among the tools for assessing groundwater quality is the Principal Component Analysis (PCA) technique. The physico-chemical and isotopic parameters were analyzed and interpreted using this technique. To explain a total variance of 92.38%, three main components F1 (65.03%), F2 (17.05%), and F3 (10.30%) have been used (Table 4).

Table 4 Correlations between variables and significant factors

According to Fig. 10, the elements Ca, Mg, Na, Cl, SO4, and EC are aligned with the F1 factor. It has a variance of 65.03% and it represents the groundwater salinity. It also indicates that the processes affecting the mineralization are the phenomenon of dissolution and ions exchange.

Fig. 10
figure 10

Plot of Component F1 (salinization), F2 (evaporation), and F3 (NO3 pollution)

The evaporation component is represented by the F2 factor where the 18O and 2H contents show significant correlations with F2 (r2 = 0.76 and r2 = 0.74, respectively). The F3 factor is reserved for the nitrate pollution component where the nitrates show a very significant positive correlation with F3 (r2 = 0.94) (Table 3 and Fig. 10). The samples shown in diagrams F1–F2, F1–F2, and F2–F3 (Fig. 11) corroborate the phenomena previously demonstrated.

Fig. 11
figure 11

Groundwater sample distribution according to their scores for salinization (F1), evaporation (F2) and NO3 pollution (F3): a F2 vs F1, b F3 vs F1, and c F3 vs F2

The samples representing the most mineralized waters are grouped in the two compartments 2 and 3 of Fig. 11a and b. This confirms the contribution of the mineral dissolution phenomenon in groundwater mineralization. In the F2–F3 diagram, two of these samples (4 and 11 representing the most isotopically depleted samples) are located on the negative side of the two F2 and F3 axes. This reflects that these two samples have not been subject to evaporation and contamination by NO3. Then, point 15 occupies the positive side of the F3 axis reflecting the NO3 pollution. Points 1 and 13 are located on the compartment 3 which represents the positive values of F2 and negative of F3, and this reflects that these two points have under18O gone the phenomenon of evaporation.

In the F1–F3 diagram (Fig. 11b), some points (e.g., 2, 8, 20, and 28) are located in the compartment 4 which represents the absence of the dissolution phenomenon and the pollution by nitrates. This suggests the evaporation phenomenon. However, on the F2–F3 chart, these points are on the negative sides. This situation could be explained by the ion-exchange phenomenon already demonstrated by the hydrogeochemical approach.

Groundwater quality

Groundwater quality for domestic purposes

In this paper, the assessment of groundwater quality for domestic purposes was made by comparing major elements concentration (Ca, Mg, Na, K, Cl, SO4, HCO3, and NO3), and TDS with the standards of the World Health Organization (WHO 2011) (Fig. 12).

Fig. 12
figure 12

Comparison of major ion contents with WHO standard values

Mean Ca level is 150.3 and 169.1 mg/L for the campaign 2018 and 1991, respectively. These values are below the standard (200 mg/L) set by WHO (2011) (Fig. 12). The same situation was observed for Mg, but in this time with lower mean values compared to those of Ca. Regarding Na concentration, the groundwater of the study area, for 2018 and 1991 campaign, has mean concentrations also below 200 mg/L (WHO standard) (Fig. 12). The average contents of SO4, HCO3, and K ions for the campaign 2018 and 1991 are lower than the limits determined by WHO (2011).

For the two campaigns 2018 and 1991, mean Cl contents well exceed the threshold fixed by WHO (2011), with levels equal to 712.30 mg/L for 2018 campaign and 642.7 mg/L for 1991 campaign (Fig. 12, Table 1).

Nitrate concentrations of the analyzed samples vary between 0.00 and 398.3 mg/L with an average of 48.4 mg/L (Table 1). The samples 9, 13, 15, 16, and 19 have nitrate concentration above 50 mg/L [limit fixed by WHO (2011)] (Fig. 13). While the rest of the points (73%) have nitrate levels below the threshold. At the first sight, NO3 contamination in the study area is punctual (Fig. 13), and the highest concentrations are marked at points 9, 13, 15, 16, and 19. These highest concentrations could be explained by: (i) the high concentration of tourism activity (Sidi Kaouki zone, near Cap Sim), (ii) the gap of a sewage system and wastewater treatment plant, and (iii) waste from livestock during watering.

Fig. 13
figure 13

Spatial distribution of nitrate contents

Mapping of groundwater quality for irrigation purposes

Due to the growing demand for freshwater and difficult climatic conditions, freshwater within Essaouira basin is becoming increasingly limited. Therefore, the management of this resource has become necessary to ensure sustainable use, by comparing the groundwater quality of the study area with the standards determined by WHO (2011), and mapping the groundwater quality through GIS tool. To evaluate the adequacy of groundwater for agricultural purposes, the parameters EC, SAR, KI, %Na, PI, TH, and MH were used (Table 5).

Table 5 Parameters for irrigation suitability evaluation

Electrical conductivity (EC) is defined as the ability of water to conduct electrical current. It is also a good tool for measuring the water salinity. EC values of the analyzed samples ranged between 916 and 9744 μS/cm with an average of 2926 μS/cm (Fig. 3). The least mineralized waters are marked in the North and East, near Ksob Wadi, and at points 2 and 3 (aquifer recharge zones). While the most mineralized waters are marked at Cap Sim, especially at point 13 (point affected by the marine intrusion). According to Varol and Davraz (2015) and for agricultural purposes, water is classified into four classes. Water with EC < 250 μS/cm is considered good quality. The 250–750 tranche is reserved for medium-quality water. Poor water quality is represented by EC values ranging from 750 to 2250 μS/cm, whereas very poor water is marked by EC values > 2250 μS/cm. For the studied sector, only the waters of the northern part (around Ksob Wadi) and the eastern part remain adequate for irrigation purposes.

Except for the two points 2 and 14 having TH < 300 mg/L in CaCO3 (Fig. 3), the rest of the analyzed points have TH values higher than 300 mg/L in CaCO3, that make the waters of the study area very hard. The highest values are marked towards Cap Sim (Fig. 3). High concentrations of hardness can result in flaking of the irrigation pipes. However, removing hardness with a water softener is not necessary unless water is a problem.

Groundwater SAR values in the study area range from 2.5 to 14 (Fig. 14). This parameter becomes more and more important going from East to West. The highest values are marked at Cap Sim. The majority of water points have SAR values below 10, reflecting that groundwater is considered suitable for irrigation. The values of %Na vary between 30 and 65% (Fig. 15). Referring to WHO standards (Table 5), the %Na values (Fig. 15) of the analyzed samples show that the groundwater is suitable for irrigation, except near sample 13 (near Cap Sim) and sample 19 (north-west part). The same situation is observed for the PI and KI values (Fig. 3), where the values become more and more important from East to West. Values that exceed the WHO standard values are marked at Cap Sim and the northwestern part of the study area, reflecting the fact that groundwater from these areas is considered unsuitable for irrigation. However, this situation could be explained by the remoteness of the aquifer recharge zone and by the marine intrusion effect, causing the increase in Na content.

Fig. 14
figure 14

USSL salinity hazard diagram of groundwater from Plio-Quaternary aquifer within Essaouira basin

Fig. 15
figure 15

Wilcox diagram of groundwater from Plio-Quaternary aquifer within Essaouira basin

Magnesium in groundwater usually comes from the dissolution of dolomite. According to Ramesh and Elango (2012), the presence of excess Mg in water can decrease the quality of the soil by increasing the production of alkalinity, which reduces the crop production.

Conclusions

This study about groundwater of the detrital Plio-Quaternary aquifer of the Essaouira basin has been able to highlight the different geochemical phenomena that can take place within this important aquifer.

The hydrogeochemical investigation shows that the groundwater of the Plio-Quaternary aquifer is characterized by the facies types: Na–Cl for the 1991 campaign, and Mix Ca–Mg–Cl and Na–Cl for the 2018 campaign. Dissolution of halite, gypsum, and/or anhydrite would contribute to the groundwater salinization of the studied aquifer. This is also in perfect agreement with the state of undersaturation of water vis-à-vis these minerals. Base-exchange and marine intrusion phenomena are generally responsible for the large variation in cation (Ca, Mg, and Na) concentrations in groundwater. The assessment of groundwater quality for domestic purposes was made by comparing major elements concentration (Ca, Mg, Na, K, Cl, SO4, HCO3, and NO3), and TDS with the standards of the World Health Organization. However, the consumption of this water requires treatment before use as drinking water. For irrigation purpose, groundwater of the studied aquifer remains suitable for plants supporting high salinity. The nitrate contamination study shows that the highest concentrations could be explained by: (i) the high concentration of tourism activity (Sidi Kaouki zone), (ii) the absence of a sewage system and wastewater treatment plant, and (iii) waste from livestock during watering. Spatial distribution of groundwater quality at fine irrigations using the geostatistical approach based on the ordinary kriging method shows that the area of "Cap Sim" remains inadequate for agricultural activity. The isotopic study provided a better understanding of the source of recharge and mineralization of this aquifer. According to the stable isotope contents, (i) the recharge of the Plio-Quaternary aquifer is ensured by the direct infiltration of precipitation of Atlantic origin and (ii) some points have been impacted by evaporation phenomena and intrusion of seawater. The principal component analysis (PCA) technique, applied to physico-chemical and isotopic parameters, confirms the results obtained by the hydrogeochemical and isotopic approach, highlighting the processes controlling the groundwater mineralization in the study area.

However, the results obtained require rational management and effective protection of the groundwater resource in the Essaouira basin, especially the "Cap Sim" zone where the intrusion of seawater into freshwater is marked, and a high risk of contamination by nitrates and consequently degradation of groundwater quality. This situation may occur in other inshore aquifers from arid and semi-arid environments, leaving us to suggest that readers from these regions take into account the approach of this paper to understand and solve the problems threatening the water resource.