KASUR, Pakistan — In Pakistan’s heartland, holy men with bells tied to their feet close their eyes and sway to the music. Nearby, rose petals are tossed on tombstones. Free food is distributed to devotees.

This peaceful tableau is part of Sufism, Pakistan’s most popular brand of Islam, which attracts millions of worshipers at about a dozen major festivals throughout the year. Each day, thousands visit shrines dedicated to Sufi saints.

But the rituals came under heavy attack in 2010, as minority hard-line militants took responsibility for five shrine attacks that killed 64 people — a marked increased compared with 2005 to 2009, when nine attacks killed 81 people.

Video

Attacks in previous years occurred in the middle of the night or when worshipers were not present, apparently in an effort to avoid casualties. But in 2010, terrorists carried out suicide bombings when thousands of worshipers were present, and in the nation’s largest cities, like Karachi and Lahore.

The increase in attacks, and a direct effort to kill those who practice a more mystical brand of Islam, has torn the fabric of mainstream worship in Pakistan. But as worshipers continue to visit the Sufi shrines and many Sufi festivals continue in the face of threats, it also evidences the perseverance of Pakistan’s more moderate brand of Islam.

“It’s a very disturbing picture that militants have extended their targets to shrines, which are symbols of popular Islam in Pakistan and are widely visited,” said Rasul Bakhsh Rais, a professor of political science at Lahore University of Management Sciences. “However, I don’t think the militants are succeeding – thousands of people still visit the shrines despite these attacks.”

Although there is no official data, the number of people who informally follow Sufi traditions is believed to be in the millions. They have long been condemned as un-Islamic by fundamentalist groups because they worship saints and perform music and dance.

The United States, meanwhile, sees Sufi Islam as a counter force to terrorism, and has helped promote it by giving more than $1.5 million since 2001 on the restoration and conservation of Sufi shrines in Pakistan.

Amir Rana, the director of the Pak Institute for Peace Studies, a think tank that analyzes religious conflict, said there were several reasons for the recent spike in attacks on Sufi shrines.

Groups within Al Qaeda, which have increased their strategic operations in Pakistan since 2007, have expanded their ideological war on the sectarian divide.

Mr. Rana also said militants suddenly changed their strategy in 2009, when they started soft targets, or popular and less secure venues, such as the Meena Bazaar in Peshawar, as a way to retain their radical sympathizers.

Other experts say that fragmented militant groups in Pakistan have fully spun out control, and the shrine attacks fit a larger pattern that finds extremist groups who in the past have focused on Kashmir and Afghanistan now turning inward to assert their power and ideology within Pakistan’s borders.

“Militancy keeps on demanding sacrifices,” Ayesha Siddiqa, a security analyst who says she is a descendant of a Sufi saint, said. “So if it’s not targeting the enemy outside, it’s targeting the enemy within.”

In the eyes of some extremists, Sufi loyalists can be viewed as cohorts of the Pakistani government. Prime Minister Yusuf Raza Gilani and Foreign Minister Shah Mahmood Qureshi both carry saint-like status because they are from prominent Sufi families that have been caretakers for shrines synonymous with the ruling elite. In turn, those in power often use such devoted followings as a tool for recruiting voters.

Pir Tayyab, a hard-line Deobandi cleric who has been associated with militant organizations, including the Pakistani Taliban, said that while it was acceptable to pray for a saint’s soul at a shrine, it is forbidden to search for God’s qualities in a saint.

“The singing and dancing that takes place at shrines is disrespectful,” he said. However, he said, bombing a shrine is also unacceptable. “It is not correct to disrespect a grave or to remove someone from his grave.”

While provincial governments have scaled back some musical performances in response to threats, the large gatherings persist, drawing big and determined crowds at major shrines on a near weekly basis.

The only major cancellation over security fears was made by the Sindh provincial government, which canceled musical performances that were a permanent feature of Karachi’s festivals.

Prodded by protests that demanded more security, the government of Punjab, which oversees more than 500 shrines, is spending $400,000 on increased security at 15 of its major shrines this year, including the installation of cameras, security gates and metal detectors. At some shrines, officials said donors had paid for new security installations.

But security is rarely a deterrent to attacks. The Pakistani Taliban remains unfazed by the government’s efforts to safeguard the shrines. The government installed two security gates in 2008 at Abdullah Shah Ghazi’s shrine, the most famous shrine in Karachi, Pakistan’s largest city. But in October 2010, two suicide bombers detonated explosives there, killing 9 and injuring 75. Since the blasts, and just before an annual Sufi celebration, the government installed 18 security cameras at the shrine.

Adam B. Ellick contributed reporting.