Mouassine Fountain
The Mouassine Fountain is a part of the 16th-century religious complex of the Mouassine Mosque in Marrakesh, Morocco. The tradition of building public fountains in Marrakesh is old but took on a very monumental character in the Saadian era. History 
The Mouassine Mosque complex was built between 1562-63 CE (970 AH) and 1572-73 CE (980 AH) on the orders of the Saadian sultan Abdallah Al-Ghalib. It includes a mosque, a library, a mîdhâ (ablutions facility), a hammam and the Mouassine Fountain. It also included a children's Qur'anic school (msid) which no longer retains its function today. The fountain is one of the largest in the medina of Marrakesh, along with the fountain of the Bab Doukkala Mosque and the Shrob ou Shouf Fountain, both also from the Saadian period. It is located in the north of the ablutions room of the Mouassine mosque. Function 
The presence of the water supply system necessary for the mîdhâ and the hammam led the Saadian architects to build open fountains with drinking troughs near the mosques. So, it was a question of ensuring the supplying of the district with drinking water, while registering this act in its religious dimension since giving to drink constitutes in the Muslim world one of the most honorable alms. The fountain is inserted next to three arches which gave access to drinking troughs for animals. The large fountain was reserved for humans while the two drinking troughs next to it; covered with vaults and opening onto the street by three arches, were used, at the time, to water the animals, especially donkeys. Architecture and ornamentation 
The medina of Marrakesh has 45 public drinking fountains. Depending on its location, each fountain has a monumental or a modest appearance. Large fountains, like that of Mouassine, abundantly decorated, are located next to mosques and/or mausoleums. These require the attribution of an architectural and decorative aspect to their annexes such as fountains. On the other hand, small neighborhoods must also have autonomy and access to water, their size therefore depends on the size of the neighborhood, some of them are decorated while others are much simpler. The Mouassine Fountain is rectangular in shape and consists of a large opening resembling a corbel arch. The arch is made out of wood and a projecting canopy of carved wood hangs above it. Next to it are three other large arches which contained the drinking troughs. All together, these four arches occupy a rectangular space measuring 18.1 meters long and 4.7 meters wide. The fountain arch has piers that support two plaster consoles on which rest corbels and three lintels protected by a canopy. The whole is in cedar wood decorated with painted and chiseled floral motifs.Inside above on a horizontal beam, a large carved plaster frieze features a geometric pattern of an eight-pointed star called "Mtemmen maa'kous". This geometric motif is inserted between two small friezes, narrower and also in carved plaster, repeat the eulogy "العز لله" meaning "The glory is to God".Above, on the wooden beam, an inscription was painted in black on a plaster frieze that no longer exists today. It is visible in an old photograph in the book “Things seen in Morocco” by Alec John Dawson (P. 207) and its restitution was possible thanks to the reproduction of A. Bernard figured in the book “Picturesque and monumental geography” (P. 206). The inscription says:

بُشْرَى فَقَدْ أَنْجَزَ اُلإِقْبَالُ ما وَعَدَا ***** وَكَوْكَبُ اُلمَجْدِ في أُفْقِ العُلا صَعِدَا

" Good news ! By a favorable fate the promises are fulfilled; and the star of glory rises on the horizon of nobility. " The corbels are decorated with a carved and painted pattern, however the polychromy is not very visible. Above the crows, on the first lintel, an inscription is chiseled on two cartridges says:

أَحْسَنُ ما صُرِفَ فيه المَقال ***** الحَمْدُ للَّهِ على كُلِّ حــال

“The most beautiful words that have been spoken (are): Praise be to God in all circumstances! " Water source: khettara 
To supply drinking water to the fountains of the medina as well as the ablution rooms of mosques, hammams and sometimes large houses, the Almoravids built an original hydraulic system called khettara. It is an underground drainage tunnel that brings water from the groundwater to the surface of the ground, then distributes it throughout the city and irrigates crops. It consists of a set of vertical wells connected to a slightly sloping drainage tunnel that conveys the water to cisterns or reservoirs. The shafts are used to dig the underground tunnel. And when the construction is finished, they play a role of ventilation and facilitate access to the tunnel for maintenance. Climate change has caused a drop in the level of water tables and the increase in population has resulted in an increase in urban planning. This system is therefore no longer sufficient and has consequently been abandoned. However, the khettara are considered a Moroccan heritage and there have been calls to preserve them. References 

Fountains in Morocco
Buildings and structures in Marrakesh
Tourist attractions in Marrakesh
Saadian architecture