In the meantime Flanders was again at war with the Count of Holland. John II, Count of Holland since 1299, also ruled over the County of Hainaut and the County of Zeeland, and was part of the House of Avesnes, the hereditary enemy of the Flemish House of Dampierre. Zealand had been contested between the Count of Flanders and the Count of Holland since the early 11th century and had become part of Holland by 1076. The Flemish invaded Hainaut in 1302 and conquered Lessines. Guy of Namur, son of the Count of Flanders, formed a fleet at Sluis and sailed on 23 April 1303 to claim Zeeland for the Flemish. After some initial successes, Guy was defeated on 10 and 11 August 1304 in the Battle of Zierikzee by a combined Franco-Hollandic fleet under Rainier Grimaldi, who had been sent by Philip IV of France to aid the Count of Holland. Guy of Namur was captured and Zeeland remained firmly in the hands of the Count of Holland. One week after this naval battle, on 18 August Philip IV himself fought the Flemish main army at the Battle of Mons-en-Pévèle. This hard fought battle was inconclusive, but the death of William of Jülich and the serious material losses of the Flemish, made them sue for peace. After further minor battles, eventually the Treaty of Athis-sur-Orge was signed on 23 June 1305 which recognized Flemish independence, but at the cost of the cities of Lille, Douai and Orchies, which were transferred to France, and the paying of exorbitant fines to King Philip IV.
Question: What happened first: the Flemish invaded Hainaut or Guy of Namur was defeated in the Battle of Zierikzee?
Answer: Flemish invaded Hainaut