The second-largest city and principal port of Iraq, which from ancient times was a center of commerce, finance, letters, poetry, and science. It was founded as a military encampment by the second caliph, 'Umar I, in 638 about 8 miles (13 km) from the modern town of az-Zubayr, southeastern Iraq. Its proximity to the Persian Gulf on the west bank of the Shatt al-Arab gives it easy access to both the Tigris and Euphrates rivers and eastern frontiers. The first architecturally significant mosque in Islam was constructed there in 665. From the late 9th century Basra suffered a series of disasters and gradually declined. The Zanj (Negro slaves who worked in the fields and plantations of southern Iraq) revolted in 869-873 and sacked the city, and in 923 it was plundered by the Qarmarthians. In 1050, parts of the city were in ruins.