“It was a targeted attack,” said Muqaddas Haider, a senior police officer in Karachi’s Central District, who noted that Mr. Sabri had been hit by three bullets. “We are investigating who could be behind the killing.”

Image Amjad Sabri, in 2015, one of the most prominent Pakistani singers of Sufi devotional songs. Credit... Umair Rao/Agence France-Presse — Getty Images

Mr. Sabri, 45, was one of the foremost singers of qawwali music — the devotional songs of Sufism, a mystical branch of Islam — and was part of a family of noted performers. In 2014, Mr. Sabri was embroiled in controversy after a morning news program played his version of a traditional qawwali song that referred to the Prophet Muhammad. A blasphemy case was registered against the show hosts and the television network, Geo, and Mr. Sabri was named in the complaint.

Mr. Sabri’s death sent shock waves throughout the country on Wednesday as condemnation poured in and people expressed anger over the killing of a beloved singer.

“For so many in Pakistan, Amjad Sabri was an iconic cultural ambassador of Pakistan just like his ancestors were for our previous generations,” said Shezreh Mirza, a prominent legal consultant. “I am at an utter loss to understand this senseless killing of a legend at the prime of his life. Pakistan’s soul stands tormented yet again today.”

As violent sectarian groups have continued to attack religious minorities and other groups in Pakistan with seeming impunity, revered Sufi shrines and gatherings have been targeted in recent years, despite a respected tradition of Sufi tolerance and art. In 2010, the shrine for the Sufi saint Abdullah Shah Ghazi came under attack in Karachi, and the same year, one of the most important and largest shrines in the eastern city of Lahore was targeted in a bombing that left 42 people dead. Sufi shrines and mosques have been repeatedly targeted in the country’s northwest.