According to a 14th-century legend, the flag dates back from the 9th century, when the four red bars were drawn, as an act of gratitude, on Wilfred I the Hairy's (Count of Barcelona) golden shield by king Charles the Bald's fingers drenched with blood from the Count's war wounds prior to Wilfred's death in 897 during the siege of Barcelona by Lobo ibn Mohammed, the Moorish governor of Lleida. This legend would relate the emblem unambiguously to the Counts of Barcelona title.