 The city remained important throughout the middle Byzantine period (7th–12th centuries).Following the rebellion of Nikephoros Melissenos, his Turkish allies captured the city in 1081, and it became the first capital of the Seljuk Turkish Sultanate of Rum until its recapture by the First Crusade in 1097.After the capture of Constantinople and the establishment of the Latin Empire by the Fourth Crusade (1204), the city became the capital of the Empire of Nicaea, and the seat of the Patriarchate of Constantinople in exile until the recapture of Constantinople in 1261.