Marrakesh, located in a more arid environment, was supplied in large part by a system of "khettara"s, an ingenious and complex system by which an underground channel was dug beneath the slopes in the surrounding countryside until it reached the level of the phreatic zone. This artificial channel was gently sloped to allow water to drain through it, but was sloped less steeply than the natural terrain so that it eventually emerged at the surface. In this way, the khettaras drew water from underground aquifers located on higher ground and brought them to the surface with the use of gravity alone. Once at the surface, the waters ran along canals and were stored in a cistern or water basin, from which they could then be redistributed across the city. This system was created under the Almoravids (who founded the city) and further developed and maintained by their successors.