Islam began in the 7th century in the Arabian Peninsula under the prophet Muhammad. It then rapidly expanded across much of the Middle East, North Africa and parts of Asia in the following centuries due to military success and the weakness of surrounding empires. As Islam spread, it influenced and was influenced by local cultures. Two main branches, Sunni and Shia Islam, developed early on due to conflicts over religious leadership. The Islamic empire established political and religious rule across its lands based on Islamic teachings from the Quran and Hadith.