Few here last week knew many of those facts but that did not seem to matter. The dancing and drumming was part of a natural rhythm of life that after nearly 10 centuries was as much about culture as it was about faith.

Image A camp near the festival. Pakistani Sufis have been challenged by the stricter form of Islam adopted by militants and hard-liners. Credit... Jason Tanner for The New York Times

“It’s a festival of happiness!” shouted a cook, Muhamed Nadim, over the din, when asked what was being celebrated. “People feel comfort here.”

Vast crowds of men walked barefoot, pushing past police barricades and vendors selling fabrics and sweets. A neon sign advertising chicken with the words “Chicks, Chicks, Chicks” glowed in a second-floor window. Underneath it, brightly lit bookstores remained open, their owners gazing out at the crowds.

One of them, Naeem Ashraf Rizvi, settled easily into a conversation with a foreigner about life in Pakistan. The overwhelming majority of Pakistanis are Sufi, he explained, and despise violence inflicted by the more hard-line Deobandis, the school of thought that was supported by General Zia.

Last year was Pakistan’s worst for militant attacks since 2001, with the death toll more than triple what it was in 2006.

“Sufis have not spread terrorism,” Mr. Rizvi said, his small daughter on his lap. “We are its victims.”

The violence, he said, has damaged not only Pakistan, but also the reputation of Muslims, who he said “are seen with suspicious gazes everywhere in the world.”