The area prospered under the rule of Hetman Ivan Mazepa (1687–1708), increasing in size and population (with upwards of 20,000 residents). Baturyn boasted 40 churches and chapels, two monasteries and a college for government officials and diplomats (the Kantseliarsky Kurin). In 1708 the Zaporozhian Cossacks became involved in the Great Northern War. Hetman Mazepa, after realizing that the Russians planned to remove him from power, switched his allegiance to Sweden (then at war with the Russian Empire) and began to place more emphasis on Ukraine's independence. On 13 November 1708 a Russian army under the command of Alexander Menshikov sacked and razed Baturyn and slaughtered all of its inhabitants in a punitive response. The Russians broke , the commanding officer of the Baturin garrison, on the wheel. Historian Serhiy Pavlenko estimates that Menshikov's army murdered 6 to 7.5 thousand civilians and 5 to 6.5 thousand military personnel. In 1708 the city had had a population of 20,000; by 1726 it had become a ghost town.