Police and security officers cordon off the site of a bombing in Lahore, Pakistan. (K.M. Chaudary/Associated Press)

A suicide bomber killed at least 13 people and injured scores Monday in the eastern city of Lahore, detonating a powerful blast on a crowded boulevard outside the provincial legislature, where hundreds of pharmacists and drug company officials were holding a peaceful protest.

Two senior police officials and four other police officers were among those killed when the bomb exploded at the edge of the rally, officials said. Television footage showed flames rising and people fleeing in panic, while ambulances, police vehicles and army trucks rushed to the area.

Police said that in addition to the dead, 80 people were injured.

“Thank God I am alive,” Zahid Sherwani, a reporter for Pakistan’s Geo News TV channel, said in a broadcast from the scene, where he and other journalists had gone to cover the sit-in rally. “I was very, very close.”

Officials said they had been warned by the federal counterterrorism agency last Tuesday that a suicide attack might occur in Lahore, prompting extra precautions. The protest, over new amendments to a drug-sales law and a shortage of licensed pharmacists, was held in an area often used for demonstrations, just outside the Punjab provincial assembly gates, and it did not appear to be specifically targeted.

“The spot where the blast took place is always under threat,” Rana Sanaullah, the law minister for Punjab province, told reporters. He said that “elaborate security arrangements” had been put in place but that the rally “gave the opportunity to terrorists to strike.”

Last week a group headed by radical Islamist cleric Hafiz Mohammad Saeed held a large antigovernment protest on the same boulevard in Lahore, as well as rallies in other cities, after authorities placed Saeed under house arrest. Other Islamist groups have denounced the government for the crackdown and called for further protests.

Saeed was accused of masterminding a terrorist siege in 2008 in Mumbai that killed 166 people. He has been detained several times since then but has never been tried or convicted. On Monday, a spokesman for his group condemned the Lahore attack and called its perpetrators “terrorists” and enemies of Islam and Pakistan.

However, a different Islamist group emailed a statement to media outlets, praising the bombing and indirectly claiming it. The message from Jamaat-ul-Ahrar named both the two slain senior police officials and the attacker, whom it called a martyr and “our beloved brother.”

Jamaat-ul-Ahrar broke away from the Pakistani Taliban in 2014 and pledged allegiance to the Islamic State. In its statement Monday, it called the Lahore attack “just the start” of a coming operation and added, “We warn all Pakistani apostate departments that they are our targets,” a reference to government agencies.

The outlawed group claimed a bombing near a church at a Lahore park on Easter last March that killed 75 people, and another in the southwestern city of Quetta in August that killed 70; the latter blast was also claimed by the Islamic State.

Pakistani Prime Minister Nawaz Sharif expressed both sorrow and defiance in a statement Monday, praising the dead police officers and vowing to continue the fight against terrorism, which has killed thousands across Pakistan in the past decade.

Lahore is at once the heart of Sharif’s provincial political base and the home of several radical and sectarian Islamist parties. Provincial political leaders have been accused of appeasing some religious groups while trying to control others.

“Terrorism isn’t a novelty for us. Our story has been one of constant struggle against its grasp, and a fight for the soul of Pakistan,” Sharif said. “We have fought this fight against the terrorists among us and will continue to fight it until we liberate our people of this cancer.”

Sharif’s government and its predecessors have sought to curb Islamic militancy with mixed success. The army has made strides against domestic jihadist groups, but some remain popular among the Muslim public, while critics including India and the United States say Pakistan continues to harbor violent militants who target neighboring countries.

Haq Nawaz Khan in Peshawar contributed to this report.