During the great Turkish expansion from Central Asia into Iran and Anatolia in the Seljuk period (11-12th centuries), Turkmen nomad tribes accepted a Sufi and pro-Ali form of Islam that co-existed with some of their pre-Islamic customs.
The Ottomans had accepted Sunni Islam in the 13th century as a means to unifying their empire, and later proclaimed themselves its defenders against the Safavid Shia state and related sects.