The precursor states to Saudi Arabia were Nejd and Hejaz. The state flag of Nejd followed today's Saudi flag pattern very closely. The state of Hejaz followed the patterns seen in countries like Palestine and Sudan. Caliphates such as the Rashiduns, Ummyads, and Abbasids used other flags with only one color. After the Sack of Baghdad in 1258 by the Mongols, the primary caliphate became Mamluk Egypt. In 1517, the Ottomans invaded Egypt and inherited Hejaz and ruled it until the Great Arab Revolt of 1916. From 1902 until 1921 a different Arabic inscription was used. One of the primary opponents to the Saudis was the Emirate of Jabal Shammar of the Al Rashid family in the north of the peninsula, until their defeat in 1921.