Qaqun was captured by the Mamluk sultan Baibars (1259–1277) in 1267. Under Mamluk rule, Qaqun was the capital of one of six districts that made up the province of "as-Sham", the Mamluk administrative unit for a part of the governorship of "Mamlakat Gaza", one of the region's three Mamluk administrative governorships, the other two being "Mamlakat Dimashq" (Damascus) and "Mamlakat Zafad" (Safed). Qaqun and also Lyyda appeared to be independent provinces later in this period. Baybars had ordered its fortress rebuilt and had its church renovated and made into a mosque. Its markets were re-established, and it soon became a commercial center with a caravanserai for merchants, travelers, and their animals. While early scholarship often attributed the construction of the fortress to Crusaders, both the fortress and mosque at Qaqun are now thought to have built during the reign of Baybars, who also built the administrative center and large market there.