While Yemen was under the rule of the Roans on the shores of the Mediterranean, Christianity was fast establishing itself and ritual fragrances became less popular, causing a considerable decline in the spice trade. Both Christianity and Judaism were introduced into Yemen by the 4th century AD. In the early part of this century Ethiopians occupied the region. By 570 AD, the great dam at Ma'rib, which had been neglected for several centuries, broke for the last time and was abandoned by the fast-declining Sabaean kingdom. The Himyarites had by this time formed an alliance with the Persians and defeated the Ethiopian invaders. Islam was introduced into the region in about 630 AD and Yemen was ruled by a series of Arab caliphs. The first mosques to be built in the Yemen were in San'a al-Janad and near Wadi Zabid. These mosques still exist. Later in the seventh century the Ummayyad and Abbasid caliphs moved their capital first to Damascus and later to Baghdad, thus diminishing Yemen's political status in the new Islamic Empire. A succession of governors of the region followed, with a number of dynasties struggling for supremacy. These dynasties included the Ziyadids, the Najahids, the Sulayhids, Egyptian Ayyubis and the Turkoman Rasulids. The most important dynasty, founded in 897 AD by Yayha bin Husayn bin Qasim ar-Rassi, were the Zaydis of Sa'da. This stable, Shiite dynasty lasted well into the 20th century. When the country became part of the Ottoman Empire in 1517, its real power was still in the hands of the Zaydi imams. The first period of rule by the Ottomans lasted for over a century, ending in 1636, when the Zaydi imams reasserted their supremacy.