In 637 A.D., 5 years after the death of Muhammad, Arab Muslims conquered the Iranian Sassanians. As a result, during the seventh to ninth centuries, most inhabitants of Afghanistan, Pakistan, the southern parts of the former Soviet Union, and northern India were converted to Sunni Islam. Eventually, Amir Abdur Rahman (1880-1901) decreed that Afghan law must comply with Islamic law, and elevated the Shari'ah over the Pushtunwali local law. (More on this later)
The 1931 Afghan Constitution established Shari'ah as the state religion, and the 1977 Constitution reaffirmed it, although Islam was quashed during the communist reign from 1978 to 1992,. Approximately 99.7% of Afghans are Muslim - 85% practice Sunni Islam, while 15% proclaim Shia.
Islam permeates Afghan society. Community mosques are the centerpieces of villages and serve not only as places of worship, but also for many other civic functions. Nearly every Afghan has studied at a mosque school, often the only formal education they receive.
The Afghan landscape also features many shrines to the saints of other faiths, and many of the oldest villages grew up around such shrines The veneration of such saints, however, is opposed by some of the more militant Islamic groups.