Blue locks replace string in an ancient Afghan tradition
All over central and south Asia, the graves of Sufi teachers have been turned into ziarrats, or shrines. (Sufism is a branch of Islam that emphasizes love.) In most of these shrines, men and women come to pray at the side of the grave and tie strings or head scarves to the shrine as a reminder to the saint to put in a good word for them with God. According to tradition, visitors run their hands over the strings as they pray to see if one comes loose and falls down. If it does, they believe that both their prayer and the prayer of the person who tied the string will be answered. At this particular shrine, in the village of Band-e Amir in central Afghanistan, worshippers leave padlocks instead of strings. Presumably it's more difficult for a padlock to open than for a string to become untied.
The shrines in Afghanistan range from a few hundred to 600 years old. The most popular may belong to great warriors, kings, poets, or martyrs of past wars. The assumption is that somebody who lived a good life and died heroically will have better access to God, so they are revered. This reverence of gravesites is a distinctly Sufi tradition. The Taliban tried to stop the tradition of worship at gravesites, calling it a form of idol worship or polytheism. But the Afghans kept doing it anyway.