From Tunisia to Morocco, sun-baked North Africa has embarked on a building spree of plants that purify sea and wastewater as climate change intensifies droughts in the water-scarce region.
Across the Maghreb region, which takes in parts of the Sahara and is plagued by scorching summer heat, countries are banking on new desalination plants and facilities that can purify wastewater for farming.
In Tunisia, struggling through its fourth year of drought, engineers recently inspected a desalination plant being built in the southern town of Zarat on the Mediterranean coast.
Across the region, "the only solution is the desalination of seawater for human consumption", said Mosbeh Helali, outgoing CEO of Sonede, the company constructing the plant.
The World Bank predicts that by 2030, the wider Middle East and North Africa (MENA) region will fall below the absolute water scarcity threshold of 500 cubic metres per person per year.
Ironically, most of MENA's existing desalination plants are powered by the very fossil fuels that belch carbon into the atmosphere, driving the global heating that is now intensifying droughts.
A large Saudi desalination plant, Al Khafji, runs on solar power, and Egypt is also planning facilities set to run on renewables -- but most existing plants rely on the climate killers oil, gas or coal.
Scientists and environmentalists also warn of the impact on marine life as the plants dump the extracted salt back into the sea as concentrated sludge.
Helali insisted this hasn't been a problem in Tunisia, where there had even been "a proliferation of aquatic life" around some discharge points, making those waters "highly prized by fishermen".
Despite concerns around energy-guzzling desalination, North African countries are embracing it as their fast-growing populations pile ever more pressure on shrinking groundwater tables and dam reservoirs.
- Lack of water 'unbearable' -
Tunisia, where some reservoirs have run dry, has imposed water rationing for months, limiting household use and banning car washing and even farm irrigation.
"We have endured water cuts since mid-May," said Mohamed Ismail, 40, who lives in central Tunis. "Every evening it's the same story: there is no more water in the house until early morning.
"Now, with the heat, the situation has become unbearable."
Tunisia built its first desalination plants in the 1970s, to purify brackish groundwater, and constructed its first seawater desalination plant in 2018, on Djerba island to supply the arid south.
Today, Tunisia's 16 desalination plants provide six per cent of its potable water. The rest comes mostly from 37 dams, but now most reservoirs are only about one-third full.
To narrow the gap, Tunisia is building three new desalination plants, including the one in Zerat. Such plants are meant to meet 30 percent of Tunisia's water needs by 2030.
Morocco is also banking on the technology, which now provides 25 percent of its agricultural needs.
The kingdom operates 12 desalination plants and has seven more in the works.
While oil-rich Gulf countries have long relied heavily on desalination, this is more difficult for Tunisia and Morocco which lack such energy wealth.
"This technology is very expensive in terms of energy consumption and it is generally found in countries rich in oil or gas," Radhia Essamin, a water management expert, told AFP.
As Tunisia struggles with a severe economic crisis, it needs help, say experts.
The cost is "colossal", said Raoudha Gafrej, a hydraulic engineer. "We absolutely need technical support, financial support, assistance to be able to implement all this."
- 'We consider it vital' -
Energy cost is less of a problem for Algeria, which has huge oil and gas resources.
It already runs 23 desalination plants and has plans for 14 more, to meet 60 per cent of its water needs by 2030.
The region's other oil giant is Libya, but it has been torn by war and turmoil since the 2011 fall of dictator Moamer Kadhafi and seen little new infrastructure built since.
Although Libya dabbled in desalination in the 1950s, Kadhafi changed course to instead tap ancient aquifers below the Sahara.
His ambitious Great Man-Made River project has linked that water with the densely populated northern coast through pipelines.
The other great, but so far largely untapped, water resource for the Maghreb is wastewater, which can be purified to make it fit for agriculture, or even human consumption as Israel has done for many years.
Tunisia already has 125 basic wastewater treatment plants that service farms and replenish groundwater, and Algeria is now looking to upgrade many of its treatment facilities.
Tunisian farmers have long used the often foul-smelling water, mainly to irrigate cotton and fruit trees but not vegetables.
A Japanese-financed plant, which opened in May in Siliana in northwest Tunisia, puts out water cleaned of 95 percent of its impurities.
Local farmer Lofti Atyaoui, 52, said it had saved his fields and almond trees.
"We consider this wastewater treatment project vital because we suffer a lot from drought," he said. "If we don't have water, we will lose our agriculture, our trees and our livestock."