The Pope ruled Marie Marriage with Agnes as illegitimate , and William was given the throne . The Pope ruled Marie 's marriage to Agnes as illegitimate and William was given the throne . The Pope ruled William 's marriage to Agnes as illegitimate and Marie was given the throne .