 However, Theobald I of Bar, who had married Henry of Luxembourg's heiress, Ermesinda, refused to relinquish Namur and attacked Philip, besieging him in Namur.The war lasted for three years until the Treaty of Dinant, signed on 26 July 1199, recognised Philip as holder of Namur.Philip was left as regent of Hainault while his elder brother, Baldwin VI, went on the Fourth Crusade and acted as guardian to Baldwin's daughters, Joanna and Margaret.