The" Blue mosque " of Magoki-Attari appeared in the X century on the site of a former unknown pagan structure. It owes its unusual name to the centuries-old cultural layer that grew up around it, which is why the mosque went 4.5 meters deep into the earth. Therefore, the locals called it an "underground" mosque or "located in a pit". Many centuries ago, near the mosque, a Bazaar actively flourished, where spices, medicinal tinctures and medicines were sold, and there was also a certain temple of the moon, after which the building was named "Mokh-mosque".
In the XII and then XIV centuries, the old religious institution was rebuilt, as it was heavily overgrown with cultural layers, which were later removed when archaeological excavations were conducted.
The Magoki-Attari mosque attracts with its figured brickwork with various carved patterns. Today it is a small building with the only surviving peshtak-an entrance portal in the form of a traditional arch. A lot of mysteries and legends are kept by these ancient walls that have entered the ground, which curious tourists listen to so carefully when visiting this ancient religious place.