In Ancient Egypt, the city was known as Tamiat, and in the Hellenistic period as Tamiathis. It was a major Ancient Egyptian port city 5 kilometres from the Mediterranean Sea.The city was mentioned by 6th century geographer Stephanus Byzantius; the city was later known as Damiata. In 431 BC, the town became a Christian bishopric. The city was conquered by the Arabs, led by Caliph Omar; the Arabs successfully resisted attempts by the Byzantine Empire to recapture it, notably in 739, 821, 921, and 968. The Abbasids used the city as an entry port to India and the Tang Empire of China. Damietta was a important naval base during the Abbasid, Tulunid, and Fatimid periods. In response, the Byzantine Empire attacked the city several times, finally sacking and destroying it in May 853. Damietta regained its importance during the Crusades; In 1169, a fleet from the Kingdom of Jerusalem, with the support of the Byzantine Empire, attacked the port, but were defeated by Saladin; in 1217, during preparations for the Fifth Crusade, it was decided that Damietta should be the focus of attack; the town was captured during the Seventh Crusade by King Louis IX of France; the city was again destroyed in 1251 by the Mamluk Sultan Baibars; the Mamluks rebuilt the fort with stronger fortifications, making the mouth of the Nile impassable for ships.