Excavations place the existence of settlements in Tehran as far back as 6000 BC. Tehran was well known as a village in the 9th century, but was less well-known than the city of Rhages which was flourishing nearby in the pre- Mongol era. In the 13th century, following the destruction of Ray by Mongols, many of its inhabitants fled to Tehran. In some sources of the Mongol era the city is mentioned as "Rhages's Tehran" . The city is later mentioned in Hamdollah Mostowfi's Nuz'hat al-Qulub (written in 1340) as a famous village.