In 1635, the Polish Government built the Kodak fortress above the Dnieper Rapids at "Kodaky", partly as a result of rivalry in the region between Poland, Turkey and the Crimean Khanate, and partly to maintain control over Cossack activity (i.e. to suppress the Cossack raiders and to prevent peasants moving out of the area). On the night of 3 or 4 August 1635, the Cossacks of Ivan Sulyma captured the fort by surprise, burning it down and butchering the garrison of about 200 West European mercenaries under Jean Marion. The fort was rebuilt by French engineer Guillaume Le Vasseur de Beauplan for the Polish Government in 1638, and had a mercenary garrison. "Kodak" was captured by Zaporozhian Cossacks on 1 October 1648, and was garrisoned by the Cossacks until its demolition in accordance with the Treaty of the Pruth in 1711.