Philip IV of France became King in 1285, and was determined to strengthen the French monarchy at any cost. The County of Flanders had been formally part of the French Kingdom since the Treaty of Verdun in 843, but had always de facto been largely, if not fully, independent from the French crown. Flanders had some of the richest cities of that time, like Bruges, Ghent, Ypres, Lille and Douai. These cities tried to keep their independence from the Count of Flanders and from the rural aristocracy. But the cities were themselves divided between the rich patricians and the urban tradesmen, united in guilds. In 1288, Philip IV of France used complaints over taxes to tighten his control over Flanders. Tension built between Guy of Dampierre, Count of Flanders and the King. In 1294, Guy turned for help to King Edward I of England, arranging a marriage between his daughter Philippa and Edward, Prince of Wales. However, Philip imprisoned Guy and two of his sons, forced him to call off the marriage, and imprisoned Philippa in Paris until her death in 1306. Guy was summoned before the king again in 1296, and the principal cities of Flanders were taken under royal protection, until Guy paid an indemnity and surrendered his territories, to hold them at the grace of the King. After these indignities, in 1297 Guy attempted to revenge himself on Philip by an alliance with Edward I of England, now at war with France. Philip responded by declaring Flanders annexed to the royal domain and sending a French army under Robert II of Artois to conquer Flanders.. How many years had Flanders been a part of the French Kingdom when Philip IV became King?