Introduction

Millions of human beings around the globe face water scarcity and suffer to meet their needs daily (García-López et al. 2022; Moussaoui et al. 2023). Water-related natural disasters, such as tropical storms, floods, and tsunamis, cause much loss of life and suffering (Annan 2005; Jodar-Abellan et al. 2019). All too often, drought strikes the world’s poorest countries, aggravating hunger and malnutrition (Annan 2005). Accessibility to safe and inexpensive drinking water is an elementary human need and a fundamental right (Hartmann et al. 2013; Russell 2010). For most of the population in arid areas in Algeria, groundwater is the dominant supply for human consumption (Kendouci et al. 2019).

Groundwater dependence has increased because of population growth, agriculture, urbanisation, and changing lifestyles which must be studied, furthermore, in the context of the current climate change (Nath et al. 2021; Pardo et al. 2022; Eekhout et al. 2021). Groundwater resources suffer from these problems, both in quantity and quality (Chakraborty et al. 2021; Boix-Fayos et al. 2020; Valdes-Abellan et al. 2020). Accessibility and quantity of drinking water are nothing without quality, as poor-quality drinking water leads to health problems that can even cause death (Karandish et al. 2018; Tian et al. 2019). When chemicals, such as nitrates and sulphates, exceed permissible drinking limits, they can cause chronic health effects (Prüss-Ustün et al. 2019; Kumar et al. 2023). In semi-arid and arid regions, agriculture has a major influence on groundwater quality because of chemical fertilisers (Wada et al. 2012). Therefore, the chemical quality of drinking water-whether from groundwater or surface water-should be checked before being delivered to consumers. The physical quality of drinking water affects its aesthetic value and acceptability, which often goes with the sociocultural beliefs of consumers. Groundwater quality in a particular area depends on natural or anthropogenic factors (Long et al. 2021; Tian et al. 2019).

The geology and the age of the water in the aquifer offer information on the velocity and dispersion of contaminants in the aquifer (Davie et al. 2008). Thus, water quality is assessed by its chemical, biological, aesthetic, and physical aspects (Pla et al. 2021; Chakraborty et al. 2021). As water has a variety of uses and purposes, each type of water has its own specific needs, standards, and guidelines. The World Health Organization (WHO) Drinking Water Guidelines define acceptable smallest threshold safety criteria to preserve consumers' health and set up "guideline values" for all water elements (WHO 2011; Kumar et al. 2023). However, WHO recognizes many other situations (cultural, economic, social, etc.) that may dictate other mandatory limits and thus give rise to national, local, or regional standards. Hence, the diversity of drinking water standards is clear, as no single universally applicable approach to drinking water standards (WHO 2011; Tian et al. 2019). Unfortunately, the WHO does not advocate adopting international drinking-water quality standards, because the conditions that force adopting other standards may impose even poorer quality. Thus, Algeria presents the Algerian water Standards (AS), used by international and regional standards. These are applied in particular tests and analytical specifications on drinking water (JORADP 2011). Therefore, water is unfit for consumption when the physic-chemical constituents of water resources exceed international or national standards or regulations.

The Water Quality Index (WQI), described by Horton et al. (1965) and developed by Brown et al. (1972), is an important indicator for assessing water quality. In this index, several chemical parameters are considered, with various weightings, to offer a set of results that find the quality of a specific water sample (Jehan et al. 2020; Rabeiy 2018; Ramos et al. 2016). Over the past decades, many studies worldwide highlighted the WQI technique’s effectiveness in describing and assessing water quality. The WQI approach has been used to assess groundwater quality in many regions (Gradilla-Hernández et al. 2020; Lumb et al. 2011; Rabeiy 2018; Wang et al. 2018) because of its ability to assess and manage water quality indicators (de Almeida et al. 2018; Song and Yao 2022). Earlier research was limited in scope: Sadat-Noori et al. (2014) used the Water Quality Index in Iran without going into the relationships between the chemical elements and their dynamics; Nong et al. (2020) studied microbiological limits in the trans-basin river in China, etc.; Rao et al. (2013) used 7 parameters to assess the water quality in Visakhapatnam in India; Derdour et al. (2020) and Derdour et al. (2021) studied the WQI in small watersheds without using Gibbs and Piper plots. Therefore, it should be noted that an important lack of scientific studies covering the manuscript’s topic in arid areas was identified. The water quality in this area has not been studied before. However, our approach suffers from limitations because of the lack of microbiological analysis data and the difficult access to boreholes in the Algerian-Moroccan borders. The method presented in this work applies to other arid regions.

Many researchers have used Geographical Information System (GIS) and Inverse Distance-Weighted (IDW) algorithms to present the Water Quality Index (WQI) (El Behairy et al. 2021). This method enables researchers to display the spatial distribution of groundwater quality and to find areas with poor water quality (Chabuk et al. 2020; Kawo et al. 2018). The IDW algorithm interpolates water quality data from sampling points to a continuous map, while the GIS provides a visual representation of the data, facilitating interpretation and analysis. Thus, the WQI provides a comprehensive assessment of groundwater quality by combining several water quality parameters into a single index, allowing for an easy comparison and assessment of groundwater quality in different regions (Li et al. 2021; Hinge et al. 2022).

This work was performed in the Ain Sefra catchment area, part of the Ksour Mountains region, in the southwest of Algeria, on the border with Morocco. This site depends on the groundwater supply, as groundwater is the only support for drinking water and agricultural water (Derdour et al. 2021). Thus, the Ain Sefra basin is where this study needs to be developed. The central aims of this study are: (i) evaluate the physic-chemical properties of the study area; (ii) show the origin of groundwater using Piper and Gibbs diagrams; (iii) find the water quality in the Ain Sefra basin using WQI analysis. Finally, obtained results were assessed and compared with Algerian standards for water quality recommendations.

Materials and methods

Overview of the study area

The area selected for this study was the Ain Sefra catchment (also known as ‘Upper Wadi Namous ‘), in south-western Algeria in a border region called “Ksour Mountains” (Fig. 1). It lies between latitudes (32°15′25.09"N and 33°5′33.78"N) and longitudes (1°2′52.84"W and 0°6′8.08"W). This region covers an area of 4590.2 Km2, representing about 15.4% of the total area of Wilaya of Naâma (Derdour & Bouanani 2019). This basin comprises 05 administrative units (known as ‘communes: Ain Sefra, Sfissifa, Moghrar, Djenien Bourezg, and Tiout).

Fig. 1
figure 1

Study area: the Ain Sefra watershed

The altitude ranges between 804.5 m and 2219.4 m above sea level (m.a.s.l). Medium and low slopes characterise the relief of the region. Because of its geographical location, the region has arid to semi-arid climatic conditions, and hydrological behaviour is characterised by spatial and temporal variability (Derdour et al. 2019). Morphologically, the Ksour Mountains are distinguished by their very high reliefs, with peaks reaching an altitude of over 2000 m.a.s.l (Djebel Aissa, 2236 m.a.s.l; M'zi, 2167 m.a.s.l, and Mir El Djebel, 2109 m.a.s.l), dotted with small valleys and alluvial terraces occupied by oases like Tiout, Moghrar, Sfissifa and Asla. The principal towns besides Ain Sefra are Tiout, Sfissifa, Moghrar, and Djenien Bourezg. The stratigraphic series in the study area ranges from the Triassic to the recent Quaternary (Fig. 2).

Fig. 2
figure 2

Geologic Map of the Ain Sefra watershed (Derdour et al. 2022)

Most of the outcrops belong to the Mesozoic formations in the Ksour Mountains. The Cenozoic sediments of the Atlas are in depressions and are represented by the continental Tertiary discordant in the small fragmented secondary. In the Southern Saharian Atlas, the post-Turonian formations are more continuously observed (Rahmani et al. 2017). The Triassic comprises versicoloured clays with gypsum and salt, while the Jurassic comprises sandstones and clays. The Berrassian or Tiloula Formation is greenish and white sandstones with gypsum clays siltstones. Barremian and Albian (“Tiout formation”) have a thickness of about 1065 m. The sandstones exist in extensive areas, occupying the heart of the synclines of the Western Sahara Atlas. This formation is divided into lower, middle, and upper members. The Cenomanian–Turonian comprises an assemblage of greenish-grey gypsiferous pelitic clays, massive dolomitic limestones, and whitish marls. The Tertiary continental series is attributed to the Mio-Pliocene and comprises scattered red sandstone layers with gypsiferous formations. The Quaternary comprises dunes and alluvial formations, located especially in the Wadis above the basin (Rahmani et al. 2017). From a hydrogeological standpoint, the watershed has three groundwater resources aquifer systems: the Quaternary aquifer, the lower Cretaceous sandstone aquifer and the Jurassic sandstone aquifer (Rahmani et al. 2017). The Albian aquifer is the largest groundwater reservoir in the research area, comprising altered sandstones and clays at the bottom and sandstones at the top (Rahmani et al. 2017). Pores and cracks characterise of this confined aquifer. In the Ain Sefra region, part of the Mont des Ksour, agriculture has broadened in recent years, which has led decision-makers to develop geophysical and hydrogeological studies to exploit the region’s groundwater.

Consequently, a series of boreholes were drilled along the syncline, exploiting over 100,000 m3/day. Ain Sefra watershed comprises a set of synclines in which Cretaceous and Jurassic sandstones represent most layers. It is enclosed between Aissa, Morghad, and Bouamoud in the North and the anticlines of Mekther, Mir El Djbel, and Mzi in the South (Derdour et al. 2018). The study area comprises four soil groups: mineral soils, saline soils, limestone-magnetic soils, and graded soils (Bouarfa and Bellal 2018). It is characterised by two major seasons, a cold one with the smallest temperatures that can reach 0 °C, and a warm one marked by the greatest temperatures of 36 °C. It belongs to the arid to the semi-arid climatic stage, in which rainfall is infrequent but violent, and evaporation is significant (Melalih and Mazour 2021). Annual precipitation ranges from 135 to 280 mm, with an average of 195.6 mm per year (Derdour et al. 2018).

Data acquisition

Groundwater quality data were collected in March 2022 from forty-three (43) boreholes to assess the aquifer system underlying the study area (Fig. 2). Samples were distributed to cover most of the study area. All water samples were gathered in polypropylene (PP) bottles that had been rinsed several times with sample water before collection and then stored at 04 °C in the field. Afterwards, all water samples were transferred to Naâma university laboratory for analysis. The samples were analysed the day they were collected. A portable multi-parameter type HANNA (HI98194) was used to measure in situ: temperature, total dissolved solids (TDS; which refer to the total amount of dissolved substances in a volume of water), the potential of hydrogen (pH), and electrical conductivity (EC). Bicarbonates were measured by titration, while nitrate (\({\text{NO}}_{3}^{ - }\)) and sulphates (\({\text{SO}}_{4}^{ - 2}\)) were determined with a UV–VIS spectrophotometer. Sodium (\({\text{Na}}^{ + }\)) and potassium (\({\text{K}}^{ + }\)) were assessed using a flame photometer. The complex metric titration method was used to find the total hardness (TH), calcium (\({\text{Ca}}^{ + + }\)), and magnesium (\({\text{Mg}}^{ + + }\)). Chloride (\({\text{Cl}}^{ - }\)) concentrations were identified using Mohr’s technique.

Gibbs diagram

The Gibbs diagram is a popular method for analysing the relationship between water composition and lithological properties of aquifers. The Gibbs diagram depicts three distinct domains: rock-water interaction, evaporation, and precipitation (Gibbs 1970). Scatter plots were plotted in a Gibbs diagram with (\({\text{Na}}^{ + }\) + \({\text{K}}^{ + }\))/(\({\text{Na}}^{ + }\) + \({\text{K}}^{ + }\) + \({\text{Ca}}^{ + + }\)) and (\({\text{Cl}}^{ - }\))/(\({\text{Cl}}^{ - }\) + \({\text{HCO}}_{3}^{ - }\)) as the abscissa and Total Dissolved Solids (TDS) as the ordinate. The Gibbs ratios are computed from the following equations (Eqs. 1, 2):

$${\text{Ration for cations}} = \frac{{\left( {{\text{Na}}^{ + } + {\text{K}}^{ + } } \right)}}{{\left( {{\text{Na}}^{ + } + {\text{K}}^{ + } + {\text{Ca}}^{ + + } } \right)}}$$
(1)
$${\text{Ration for anions = }}\frac{{{\text{Cl}}^{ - } }}{{\left( {{\text{Cl}}^{ - } {\text{ + HCO}}_{{3}}^{ - } } \right)}}$$
(2)

It should be noted that all ionic concentrations are represented in meq/l (Gibbs 1970).

Piper plot

The Piper plot or diagram was used to understand issues related to groundwater geochemical dynamics. The Piper diagram was used to classify the diverse groundwater facies (Piper 1944). There are three separate fields in this diagram, including a diamond-shaped field and two triangular areas. Cations are plotted as a single point in the left triangle in proportion to total cations in meq/l, because anions are placed in the other triangle. Each parameter is then projected into the upper field along a parallel line. The intersection of this parallel with the upper edge characterises the water, as shown by the interaction between cations and anions. The trilinear diagram can show similarities and variations among groundwater samples. Based on this diagram, samples of comparable quality will be presented together as groups.

Water quality index (WQI)

The “WQI” indicator shows the overall quality of water fit for human consumption considering the effects of much water quality criteria (Brown et al. 1972; Chakraborty et al. 2021; Horton et al. 1965). The WQI is calculated:

–Step 01: Allocating a weight (Wi). In this step, a weight (wi) has been assigned to each of the 12 physicochemical limits of the study (Table 1). This weight reflects the relative importance in terms of overall drinking water quality.

Table 1 Weighting of each physicochemical parameter

Nitrates and TDS were assigned the largest weighting rate of 5 because of their important influence on groundwater quality. Magnesium had the lowest weighting rate (1) because of its low influence in determining water quality. Other factors (pH, EC, \({\text{Na}}^{ + }\), \({\text{Ca}}^{ + + }\), \({\text{Cl}}^{ - }\), \({\text{SO}}_{4}^{ - 2}\) and TH) were assigned to values between 2 and 4 according to their significance in assessing water quality (Damo et al. 2013; Nong et al. 2020), as shown in Table 1.

–Step 02 Proportional weight calculation. Equation 3 was used to compute the proportionate weight (Wi) in this step:

$$W_{i} = { }w_{i} /\mathop \sum \limits_{i = 1}^{n} wi$$
(3)

where Wi denotes the proportional weight, n is the total number of parameters, and wi denotes the weight of each parameter (Brown et al. 1972).

–Step 03 Rating scale of quality assignment. Then, Eq. 4 was used to set up the quality rating scale (qi) for each parameter:

$$q_{i} = { }\left( {C_{i} /S_{i} } \right)\, \times \,100$$
(4)

where qi denotes the quality rating scale, Ci denotes the concentration of each chemical parameter in mg.l−1 and Si denotes the drinking water standards (mg l−1) (third column in Table 1).

–Step 04 Sub-index value determination. The sub-index values \(SI_{i}\) for all chemical characteristics are determined in this phase by multiplying the proportional weight, as shown in Eq. 5 (Chakraborty et al. 2021; Horton and Hawkins 1965):

$$SI_{i} = { }W_{i} \, \times \,{ }q_{i}$$
(5)

–Step 05 Final WQI calculation. WQI was calculated in the last phase by summing all the sub-indices from all samples of the study area together, as described in Eq. 6:

$$WQI = { }\sum SI_{i}$$
(6)

where \(SI_{i}\), \(i\) is the parameter’s subindex (Brown et al. 1972; Horton and Hawkins 1965).

–Step 06 WQI classification. Thus, the results of the computed Water Quality Index (WQI) were divided into five groups: (i) if the WQI is greater than 300, the water is unsafe to drink; (ii) when the WQI is between 200 and 300, the water is very poor; (iii) in the case of WQI, it ranges between 100 and 200, the water is poor; (iv) when the WQI is between 50 and 100, the water is good; and v) if the WQI is less than 50, the water is excellent.

Spatial variation

The study area boundaries were digitised using the ArcGIS software (ArcGIS 2020). Using a GARMIN-GPS Forerunner-945, the precise locations of monitoring water points were well-recorded.

The Inverse Distance Weighted (IDW) interpolation method (Shepard 1968; Charizopoulos et al. 2018) was used to analyse the spatial variation of a pollutant load and nutrient concentrations (mg l−1). With this approach, spatial variation maps were generated (Achilleos 2011; Maleika 2020). The IDW has employed a deterministic model method, which calculates unknown values based on the closeness of adjacent points (Asadollah et al. 2023). This IDW approach is used to characterise pollutant distribution and to find physicochemical patterns in space and time (Kanagaraj and Elango 2016). Spatial distribution maps of EC, TH, pH, TDS, major cations, major anions, and WQI were generated for the Ain Sefra catchment. These maps can be useful tools for decision-making and water resource management.

Pearson correlation

Pearson’s correlation coefficient was calculated with the WQI and other water quality limits. This coefficient underlines how much each parameter matters and its effect on the hydrochemical process in the case of the Ain Sefra watershed. If (R) values of the Pearson's correlation matrix are close to + 1 or − 1, they are strong correlation coefficients and represent total correlation, or functional dependence, between two variables (Asadollah et al. 2023; de Vente et al. 2011). If the values are close to zero, no significant interaction exists between the two variables. The parameters are highly correlated if R is greater than 0.8 and are moderately correlated if R is between 0.4 and 0.8 (Tajmunnaher et al. 2017).

The general flowchart of the procedure that visualizes this approach’s stages is shown in Fig. 3, where Step 1 informs that the data were gathered during March 2022 following the USGS normal procedures, as described in “Data acquisition”. These data were required to do spatial interpolations. In Step 2 data, gathered in step 1, were used to calculate the Water Quality Index (WQI), as described in “Water Quality Index (WQI)”. In Step 3, the Gibbs and Piper diagrams were performed in “Gibbs diagram” and “Piper plot”. Finally, in Step 4, correlation analysis was accomplished to highlight the relevance of each parameter independently and their effect on the hydro chemistry process in the Ain Sefra basin.

Fig. 3
figure 3

Workflow of the system

Results and discussion

Characterisation of the groundwater samples

Table 2 shows the data collected from the study catchment, where physicochemical parameters and hydrochemical properties were calculated. Key values of these parameters are shown within four statistical analyses: the minimum (Min), the maximum (Max), the mean and the standard deviation (SD). Detailed information on these parameters can be found in the Supplementary material of the present manuscript. Likewise, these results were compared with Algerian standards (JORADP 2011).

Table 2 Data of groundwater quality parameters of the Ain Sefra watershed

Spatial distribution of the physico-chemical parameters

The Inverse Distance Weighted (IDW) interpolation approach has been used to create various spatial distribution maps of physicochemical parameters. This interpolation method showed the best model performance among the considered methods (Table 3).

Table 3 Performance of eleven interpolation methods in the Ain Sefra watershed considering the Pearson correlation (R) and the Root Mean Square Error (RMSE)

The highest pH and TDS values are found in the Tiout region (Fig. 4a, b). The electrical conductivity (EC) measurements were successful (except in well number (33)), because the measured values were below the limit for water set by the standards (2800 µδ cm−1; Fig. 4c). The lowest mean value (of 200.0 µδ cm−1) was found at borehole number 35. Therefore, a close relationship between electrical conductivity (EC) and TDS has been identified. In this current research work, the observed total hardness range was 16.28–156.31 mg l−1, where total hardness (TH) values show a gradual increase from west to east (Fig. 4d).

Fig. 4
figure 4

Spatial distribution of the Ain Sefra watershed a pH, b TDS, c EC, d TH

In accordance with the spatial distribution of calcium (Fig. 5a), only three wells (No.13, No.19, and No.21) exceed the Algerian standards. In the spatial distribution of magnesium (Fig. 5b), it can be observed that the Tiout region depicts a high concentration of magnesium. It should be noted that magnesium has a lower concentration than calcium. Spatial analysis of potassium at the water sampling points showed that most of the samples had potassium concentrations within the desired range of 12 mg l−1 (Fig. 5c). Figure 5d shows the spatial distribution of sodium. The highest concentrations of sodium (360 mg l−1 and 390 mg l−1) have been found in the groundwater samples (No.32 and No.24).

Fig. 5
figure 5

Spatial distribution of major cations in the Ain Sefra watershed: a \({\text{Ca}}^{ + + }\), b \({\text{Mg}}^{ + + }\), c \({\text{K}}^{ + }\), d \({\text{Na}}^{ + }\)

Based on to the spatial analysis of chloride, the highest chloride concentration is found in the Southwestern part of the research area (Fig. 6a). In the spatial distribution of bicarbonates (Fig. 6b), it can be observed that the south of the study area depicts a high concentration of bicarbonates. The lowest values of nitrate concentration were detected in the southern part of the study area (Fig. 6c). In addition, a gradual increase is observed from the south to the north, justified by agricultural activity in this area. Significant levels of sulphates in groundwater samples are presented in well number 13 as reported by the spatial analysis of sulphates in the study area (Fig. 6d).

Fig. 6
figure 6

Spatial distribution of major cations in the Ain Sefra watershed: a chlorides; b bicarbonates; c nitrates; d sulphates

Piper plot

Grapher software (Version 16.2.354) has been used to plot the geochemical results on a Piper trilinear plot (Fig. 7). The groundwater collected in the Ain Sefra basin has shown that mixed Ca-Mg-SO4-Cl facies predominate. Most of the samples in our study belong to the mixed Ca-Mg-SO4-Cl zone. This results in the chemical masking of the groundwater because of rock-water interaction, longer residence time, and reactions within the unsaturated zones.

Fig. 7
figure 7

Piper trilinear diagram in the Ain Sefra basin

Gibbs plot

The Gibbs plot depicted that the predominant samples fall in the dominant rock-water interaction field of this diagram and, to this extent, in the evaporation domain (Fig. 8). The dominant rock-water interaction field shows how rock chemistry interacts with the chemistry of penetrable subsurface water (Boansi-Okofo et al. 2021; El Osta et al. 2022).

Fig. 8
figure 8

Gibbs diagram of the Ain Sefra basin

Thus, water–rock interaction is the crucial factor controlling the chemical composition of groundwater. The results showed that the chemical compositions of water depend on the geology, where the groundwater is located. Thus, salinity affects the groundwater in the Berrassian formations characterised by evaporite minerals. The saline contamination occurred during the groundwater recharge period. In the case study, a better quality of groundwater samples was observed in the Albian formations.

Water quality index (WQI) assessment

Using the inverse distance weighted (IDW) approach, the map of the spatial distribution of the “WQI” for groundwater samples was created for the Ain Sefra watershed (Fig. 9). Table 4 shows the WQI calculation for the groundwater samples. It has been concluded that in 9 samples falling into the excellent category, 30 were classed as good. The WQI in three wells in the area (13, 19, 24 and 26) was characterised as poor because of high electrical conductivity values, total dissolved solids, and sulphate concentration. According to our findings, the best groundwater samples are found in Cretaceous (Upper and Albian) formations, which confirms the results of the Gibbs plot. In contrast, the wells close to the poor water are in Berrassian formations (“Tiloula”). From this, we deduce that the water quality deterioration was related to the geological formations. Mineralized water is leached with chemical elements during the groundwater recharge period.

Fig. 9
figure 9

Spatial distribution of WQI in the Ain Sefra watershed

Table 4 Classification of each sample using the Water Quality Index (WQI)

The main evaporite minerals gypsum, anhydrite, halite; and halite-related evaporite minerals, such as epsomite, bischofite, and sylvite dissolve in water and enrich it with sulphates and chlorates. Consequently, the WQI map of the study area is a valuable and effective tool for disseminating and monitoring data to decision-makers. In this way, a better overview of the current groundwater quality in the region is achieved.

Correlation analysis

This study examines the correlation between chemical parameters and WQI values using a correlation matrix (Table 5). It is observed that potential hydrogen (pH), nitrate (\({\text{NO}}_{3}^{ - }\)) and bicarbonates (\({\text{HCO}}_{3}^{ - }\)) are not correlated with other variables. Pearson’s coefficient ranges from − 0.311 and 0.282; − 0.276 and 0.1 and − 0.072 and 0.102, respectively. Total hardness (TH), Total Dissolved Solids (TDS) and sulphates (\({\text{SO}}_{4}^{ - 2}\)), are significantly correlated, reflecting a correlation value higher than 0.80.

Table 5 Pearson correlation coefficient of the analysed groundwater quality parameters

The WQI shows low correlations with a potential hydrogen (pH), nitrates (\({\text{NO}}_{3}^{ - }\)) and bicarbonates (\({\text{HCO}}_{3}^{ - }\)). It shows moderate correlations with chlorides (\({\text{Cl}}^{ - }\)), sodium (\({\text{Na}}^{ + }\)), and potassium (\({\text{K}}^{ + }\)), and finally, excellent correlations with total dissolved solids (TDS), electrical conductivity (EC), total hardness (TH), sulphates (\({\text{SO}}_{4}^{ - 2}\)), calcium (\({\text{Ca}}^{ + + }\)) and magnesium (\({\text{Mg}}^{ + + }\)). The greater influence on groundwater quality of these chemical parameters confirms that the chemical compositions of water depend (to a large extent) on the geology, where the groundwater is located.

Discussion

Much information has been achieved in the groundwater gathered in the Ain Sefra basin, which was tested within Algerian Standards (JORADP 2011). The potential of hydrogen (pH) depicted ranges between 7.03 and 8.50 and its average is 7.75 (alkaline region as pH > 7.0). These findings are similar to the results of the study of Derdour et al. (2020) in the Naâma watershed, located approximately 70 km north of the Ain Sefra basin, where they reported a mean pH of 7.71.

The TDS concentrations in the samples from our research area vary from 339 to 3220 mg.l-1. WHO recommendations specify a limit of 1000 mg l-1 (WHO 2011) and this limit is met in 65% of the water samples. It should be noted that Algerian standards do not stipulate a limit for TDS (JORADP 2011). The values achieved are adequate in 42 of the 43 boreholes analysed (TDS values below 3000 mg l-1) (Sarath-Prasanth et al. 2012). Boreholes 33 and 13 showed high values (3220 and 2886.4 mg l-1; Table 2) to be analysed. These results are lower than those reported in the study of Hamlat and Guidoum (2018), which assessed groundwater quality in six major urban centers in Northwestern Algeria (Oran, Ain Témouchent, Tlemcen, Sidi Bel Abbes, Saida, and Mascara), where TDS levels varied from 400 to 6400 ppm. In cities like Baghdad, values exceeding 600 ppm were found (Al-Dulaimi and Younes 2017), the greatest permissible value for drinking water. The EC of the samples in the research area ranges from 200.0 to 5500.0 (µδ cm−1), with a mean value of 1265.12 (µδ cm−1). These values significantly surpass the EC levels found in the Naama watershed, where electrical conductivity ranged from 551 to 1084 µS/cm, with an average value of 777.14 µS/cm. Moreover, our results also exhibit considerably higher EC values compared to other countries’ findings, such as Guinea-Bissau with 521 µS/cm (Bancessi et al. 2020), Ethiopia with 192.14 µS/cm (Meride and Ayenew 2016), and 170.6 µS/cm (Desye et al. 2021).

Calcium concentrations in the research’s groundwater area range from 12 to 427 mg.l−1, significantly higher than those observed in the Adrar region located in the south of Algeria, in the study conducted by Bendida et al. (2021), where the mean calcium concentration was reported as 87.82 mg l−1. Furthermore, the calcium values in our study surpass those found in Taiwan, where Yang (1998) reported 34.7 mg l−1, as well as in the US and Canada (Morr et al. 2006), where values ranged between 1 and 135 mg l−1, with an average of 21.8 mg l−1. Although most of the calcium concentrations in our research fall within the permissible range defined by the Algeria’s standards, which set a maximum value of 200 mg l−1, there are notable differences compared to other regions and countries (JORADP 2011).

Magnesium values found in the research area ranges from 5.0 mg l−1 to 160.0 mg l−1. These values are somewhat similar to the results observed in the Saida aquifer system, located in the western part of Algeria, where magnesium concentrations ranged from 12.2 to 148.8 mg l−1 (Djidi et al. 2008). Other works identified values of 13.5 mg l−1 of magnesium in Taiwan (Yang 1998), as did a study focused on identifying relationships between Ca and Mg concentrations in drinking water and the risk of cardiovascular disease (Nerbrand et al. 2003). Other approaches in Slovakia identified values of 78–155 mg l−1 and 28–54 mg l−1 for calcium and magnesium as adequate for reducing mortality in cardiovascular diseases (Rapant et al. 2017). In the Ain Sefra basin, the magnesium results (except well number 15) are within standard limits (around 150 mg l−1).

The sodium values in the water sampling points in our study area are found to be between 21 and 390 mg l−1 (the greatest concentration allowed in drinking water, 200 mg l−1). These values are lower than the sodium levels reported in the Naama watershed study conducted by Derdour et al. (2020), where sodium ranged from 21 to 806 mg l−1. Similar values (below 200 mg l−1) were found in Ethiopia (Arega 2020). Drinking water is a source of daily sodium and a risk factor for hypertension. Some approaches quantified 20% of stroke death are because of high-sodium diets (Scheelbeek et al. 2017) and each 100 mg l−1 reduction in sodium in drinking water involved a blood pressure reduction of 0.95 and 0.57 mmHg in systolic and diastolic blood pressure (IHME 2015). The average potassium concentration ranges from 2 mg l−1 in well number 12 to 31.23 mg l−1 in well number 31. Similar values to these recognized were reached in Adrar, Algeria: 7–29.6 mg l−1 (Bendida et al. 2021), Malaysia: 0–36.7 mg l−1 (Hamzah et al. 2014). Average concentrations of potassium in raw drinking water vary between 1 and 8 mg l−1 (Canada 2008). The mean cations concentration followed a descending order as \({\text{Ca}}^{ + + }\) > \({\text{Na}}^{ + }\) > \({\text{Mg}}^{ + + }\) > \({\text{K}}^{ + }\), being their concentrations 130.7, 107.3, 56.2, and 7.6 mg l−1, respectively.

The mean chloride values in this study area ranged from 10 mg l−1 in groundwater sample number 11 to 631 mg l−1 in groundwater sample number 34. Except for sample number 34, the chloride concentration was within the guideline range established by Algerian Standards. Comparatively, the chloride levels in our study are lower than those found in the western region of Algeria, as reported by Hamlat and Guidoum (2018), where chloride concentrations ranged between 370 and 3618 mg l−1. The presence of high chloride, sodium, and EC levels, along with elevated calcium, strongly suggests that rock-water interactions play a significant role in deteriorating groundwater quality.

Bicarbonate concentrations range from 141 to 360 mg per litre. These values are higher compared to the bicarbonate levels found in the Naama watershed, where they ranged from 190 to 272 mg l−1 (Derdour et al. 2020). When nitrate concentrations exceed 100 mg l−1, they become detrimental to certain aquatic species. The nitrate concentration in the study’s groundwater ranges from 1.02 mg.l−1 at sampling station No.36 to 97.3 mg l−1 at sampling station No.23, with a mean value of 26.51 mg l−1. These values closely resemble the results reported in other regions: Adrar with 23.97 mg l−1 (Bendida et al. 2021), Naama with 28.6 mg l−1 (Derdour et al. 2020) and Bechar with 28 mg l−1 (Kendouci et al. 2019). Approximately 94% of the groundwater was within the Algerian Standards (50 mg l−1). The mean sulphates concentration ranges between 38.0 and 1512.0 mg l−1 in the groundwater samples. Some observe that the guide value (400 mg l−1) prescribed by Algerian Standards (2011) is met for all samples, except for No.14, No.19, No.24, No.26 and No.39. These sulfate values are significantly higher than those obtained in the study conducted by Mansouri et al. (2022) in the Ouargla Basin, placed in the South of Algeria, where sulfate values ranged from 476.00 to 2290 mg l−1. For anions, the mean concentration follows a descending order as \({\text{SO}}_{4}^{ - 2}\) > \({\text{HCO}}_{3}^{ - }\) > \({\text{Cl}}^{ - }\) > \({\text{NO}}_{3}^{ - }\), being their concentrations 305.3, 232.3, 181.3, and 26.5 mg l−1, respectively.

The Water Quality Index, Gibbs and Pipers plots and correlation analysis were used to show whether the water samples from the Ain Sefra watershed are safe for human use. From a health standpoint, excessive levels of calcium and magnesium in tap water from the studied area are not harmful to human health. Nevertheless, they may alter the taste of the water. The groundwater samples from the study area belong to the soft water category (TH > 150 mg l−1). There are no obvious health effects of high conductivity. Potassium and sodium are necessary elements for humans but are rarely, if ever, found in drinking water in amounts harmful to healthy people. High sulphate values in drinking water involve a detectable taste, and if the amount is high, it can have a laxative effect on people who are not used to it. High sulphate values are distributed in the regions of the Berrassian formations that are characterised by evaporite minerals. The highest chloride concentration is found towards the south, which gives a saline taste and may cause laxative effects on unaccustomed people.

Results showed that cations were in the following order: \({\text{Ca}}^{ + + }\) > \({\text{Na}}^{ + }\) > \({\text{Mg}}^{ + + }\) > \({\text{K}}^{ + }\) and anion abundance was in this order: \({\text{SO}}_{4}^{ - 2}\) > \({\text{HCO}}_{3}^{ - }\) > \({\text{Cl}}^{ - }\) > \({\text{NO}}_{3}^{ - }\). Thus, compared to many approaches listed above, such as Rao and Nageswararao (2013), Sadat-Noori et al. (2014), Nong et al. (2020), Derdour et al. (2020) and Derdour et al. (2021), the methods used offer better results, which can be extrapolated to many arid areas. In the present study, our results showed that the chemical compositions of water depend on the geology, where the groundwater is located. Similar trustworthy findings were achieved by Derdour et al. ((2020), Boansi-Okofo et al. (2021), Latha (2022), El Osta et al. (2022), Hornero-Díaz (2018), Pla et al. (2021) and Baudron (2013) in arid areas of Argelia, Ghana, Saudi Arabia, India and the southeast of Spain.

Conclusions

The main conclusions obtained in the present study are listed here:

  1. (i)

    Most of the water quality measurements tested in the Ain Sefra basin, together with pH, EC, major anions and cations and TDS, were within the limits allowed by Algerian standards. The principal anion and cation abundances are in descending order: \({\text{SO}}_{4}^{ - 2}\) > \({\text{HCO}}_{3}^{ - }\) > \({\text{Cl}}^{ - }\) > \({\text{NO}}_{3}^{ - }\) and \({\text{Ca}}^{ + + }\) > \({\text{Na}}^{ + }\) > \({\text{Mg}}^{ + + }\) > \({\text{K}}^{ + }\). Sulphates (\({\text{SO}}_{4}^{ - 2}\)) and calcium (Ca) are the most common ions among anions and cations. Thus, these parameters can be tested to save time, money, and energy in routine examinations while producing acceptable results if other parameters are not available. In fact, our study depicts limitations because of the lack of microbiological analysis data and the difficult access to boreholes in the Algerian-Moroccan borders.

  2. (ii)

    The groundwater in the studied watershed depicts a Ca-Mg-SO4-Cl type as stated by piper's trilinear diagram. The Gibbs plot highlights that most of the samples fell into the field of dominant rock-water interaction. Therefore, the geology where the groundwater is located is the key element which controls the chemical groundwater composition. Other factors influencing water quality are the type of rocks, the geological formation, and the weathering process occurring in the region. The Berrasian formations, characterised by many evaporite minerals, depict problems of high-water salinity. The formation of these evaporites was caused by the contaminated water from the adjoining aquifers. The best quality water among the analysed groundwater samples belongs to the Albian formations. Therefore, local authorities should stop drilling wells in the Berrassian formations.

  3. (iii)

    The groundwater classification, based on the WQI, has shown that 20.9% of the water samples are of excellent quality, 69.8% are of good quality and 9.3% are of poor quality. Likewise, to distribute major ions in the study region and to assess the spatial distribution of drinking water quality, the IDW interpolation technique was used. Thus, integrating WQI and GIS allows creating of maps to represent the spatial distribution of water quality parameters, based on the analysis of data extracted at different stages of operation. This research has contributed to understanding the physic-chemical properties of water in the Ain Sefra basin. The outcome of this research work can be used by policy-makers, and local and regional authorities, to improve groundwater management and offer safe drinking water to all populations in arid and semi-arid areas.