The Magoki-Attari "Deep Mosque" appeared in the 10th century on the site of a former unknown pagan structure. The mosque received its unusual name due to the centuries-old cultural layer, because of which the mosque went 4.5 meters deep into the earth. Therefore, the locals called it “subterranean" mosque or "located in the pit" mosque. Many centuries ago, a bazaar was actively flourishing near the mosque, there were spices, medicinal tinctures and herbs on sale, and there was also a certain temple of the Moon, so people called the construction - "Moch mosque". In the XII and then XIV centuries, the ancient spiritual institution was rebuilt, as it was heavily overgrown with cultural layers, which were removed later when archaeological excavations were conducted.
The Magoki-Attari mosque attracts its figured brick masonry with a variety of carved patterns. Today it is a small structure with a single preserved peshtak - the entrance portal in the form of a traditional arch. The curious tourists visiting this ancient religious place try to understand all its mysteries and legends stored by these ancient walls.