Joan III, Countess of Artois and Burgundy, entered into the dynastic allegiance with the ducal House of Burgundy, a cadet branch of the royal Capetians, by marrying Odo IV of Burgundy in 1330. Until 1350 all territories of Artois, Franche-Comté and the Burgundian duchy were inherited by their grandson Philip I of Burgundy. Upon Philip's death in 1361 however, Artois reverted to the second daughter of Joan, Margaret, and after her death once again to Flanders ruled by her son, Count Louis II in 1382. In 1384 all Flanders, Artois and Franche-Comté finally became part of the vast, complex territory of the Duchy of Burgundy, as Louis' daughter and heiress Margaret III had married Duke Philip the Bold in 1369.