Because of its harbour, Chittagong had been an important place for trade, bringing Arab traders as early as the 9th century CE. The region fell under the rule of kings from Arakan in the 16th and 17th centuries, but later, the Mughal army under Islam Khan conquered Chittagong. During the 17th century, the region also faced a lot of attacks by Portuguese pirates. The Mughals established Chittagong as a district in 1666. The Chittagong Hill Tracts were separated from Chittagong in 1860. Cox's Bazar was separated into a district in 1984.