The tribes in the northern part of Oman were converted to Islam during the first generation of the Islamic era -- the middle of the 7th century AD and shortly after, came under the rule of the Ummayyads whose centre was in Damascus. About a century later, the Omanis revolted against the Ummayyads and expelled them from their country. The Ummayyads themselves had only a short time remaining as the leaders of the Muslim world for they were soon overthrown by the Abbasids whose capital was in Baghdad.
Oman took advantage of the dynastic strife in Damascus around the year 751 and elected an imam who gradually evolved from a local spiritual leader to a temporal sovereign. While the its wealth gave the imam substantial power in the entire Gulf region, Oman became an object of consecutive invasions by the Ummayyad caliphs of Baghdad, the Mongols the Persians.
Oman managed to remain free of the Abbasids and continued its adherence to Ibadi Islam which is still dominant in the country today. Because of Oman's remoteness from other Muslims, the Ibadis survived as a group long after they had vanished from other parts of the Muslim world.