Islamic conversion, Iranian dynasties, and Portuguese control

Traditional Islamic accounts state that Al-ʿAlāʾ Al-Haḍrami was sent as an envoy to the Bahrain region by the prophet Muhammad in AD 628 and that Munzir ibn-Sawa al-Tamimi, the local ruler, responded to his mission and converted the entire area.[17]

In 899 AD, the Qarmatians, a millenarian Ismaili Muslim sect seized Bahrain, seeking to create a utopian society based on reason and redistribution of property among initiates. Thereafter, the Qarmatians demanded tribute from the caliph in Baghdad, and in 930 AD sacked Mecca and Medina, bringing the sacred Black Stone back to their base in Ahsa, in medieval Bahrain, for ransom. According to historian Al-Juwayni, the stone was returned 22 years later in 951 under mysterious circumstances. Wrapped in a sack, it was thrown into the Great Mosque of Kufa in Iraq, accompanied by a note saying "By command we took it, and by command we have brought it back." The theft and removal of the Black Stone caused it to break into seven pieces.[14][18][19]

Following a 976 AD defeat by the Abbasids,[20] the Quarmations were overthrown by the Arab Uyunid dynasty of al-Hasa, who took over the entire Bahrain region in 1076.[21] The Uyunids controlled Bahrain until 1235, when the archipelago was briefly occupied by the Iranian ruler of Fars. In 1253, the Bedouin Usfurids brought down the Uyunid dynasty, thereby gaining control over eastern Arabia, including the islands of Bahrain. In 1330, the archipelago became a tributary state of the rulers of Hormuz,[22] though locally the islands were controlled by the Shi'ite Jarwanid dynasty of Qatif.[23]

Until the late Middle Ages, "Bahrain" referred to the larger historical region of Bahrain that included Al-Ahsa, Al-Qatif (both now within the Eastern Province of Saudi Arabia) and the Awal Islands (now the Bahrain Islands). The region stretched from Basra in Iraq to the Strait of Hormuz in Oman. This was Iqlīm al-Bahrayn's "Bahrayn Province". The exact date at which the term "Bahrain" began to refer solely to the Awal archipelago is unknown.[24] In the mid-15th century, the archipelago came under the rule of the Jabrids, a Bedouin dynasty also based in Al-Ahsa that ruled most of eastern Arabia.

In 1521, the Portuguese allied with Hormuz and seized Bahrain from the Jabrid ruler Migrin ibn Zamil, who was killed during the takeover. Portuguese rule lasted for around 80 years, during which time they depended mainly on Sunni Persian governors.[25] The Portuguese were expelled from the islands in 1602 by Abbas I of the Safavid dynasty of Iran, who declared Shia Islam the official religion of Bahrain.[26] For the next two centuries, Iranian rulers retained control of the archipelago, interrupted by the 1717 and 1738 invasions of the Ibadhis of Oman.[27][28] During most of this period, they resorted to governing Bahrain indirectly, either through the city of Bushehr or through immigrant Sunni Arab clans. The latter were tribes returning to the Arabian side of the Persian Gulf from Persian territories in the north who were known as Huwala (literally: those that have changed or moved).[25][29][30] In 1753, the Huwala clan of Al Madhkur invaded Bahrain on behalf of the Iranians and restored direct Iranian rule.[31]