An Afghan member of the security forces stands guard as a man helps schoolchildren run from the site of clashes near Pakistan's consulate in Jalalabad, capital of Nangahar province, on Wednesday. (Mohammad Anwar Danishyar/AP)

The Islamic State claimed it carried out an attack on a Pakistani consulate in Afghanistan on Wednesday that killed seven Afghan security personnel.

No casualties were reported among those inside the consulate in the eastern city of Jalalabad, near the border with Pakistan, officials said.

“Our security forces say that the target of the attack was the Pakistani Consulate,” said Ahmad Zia Abdulzai, an aide to the governor of Nangahar province. “The consulate has suffered some damages, but no one has been wounded or killed inside it."

The Islamic State asserted responsibility for the attack in a statement released online. Nangahar is the stronghold of the Islamic State’s so-called Khorasan branch, which has battled both the Afghan government and the Taliban.

Wednesday’s assault came three days after Afghan President Ashraf Ghani visited Jalalabad, the provincial capital, and declared that the Islamic State “has no room in the Afghan society.”

The attack showed a level of orchestration previously not seen from the Islamic State in Afghanistan, raising concerns that the group's ability to carry out complex operations is increasing. Afghan officials have acknowledged that the group, which recently launched its own radio station in Nangahar, is growing stronger.

Ghani telephoned Pakistani Prime Minister Nawaz Sharif to express his “concern and grief” about the attack, according to a statement from Sharif's office. Ghani also promised more security for Pakistani diplomats in Afghanistan.

The attack, the first in years to target Pakistani officials in Afghanistan, took place nine days after a similar assault on an Indian consulate in northern Afghanistan. It also coincided with diplomatic discussions aimed at bringing peace to Afghanistan in which Afghan and Pakistani representatives are taking part.

On Monday, officials from those countries, China and the United States met in Islamabad to begin crafting a road map for peace talks with the Taliban and other insurgent groups in Afghanistan.

“Whichever group carried out the attack, they want to disrupt the peace talks,” said Najib Mahmood, a political science professor at Kabul University. Officials vowed not to let that happen.

“The terrorists behind Jalalabad attack today are exactly the type of enemies & spoilers we all need [to] identify & oppose [with] all means available," the Afghan ambassador to Pakistan, Janan Mosazai, said on Twitter.

The attack began about 8 a.m. when a suicide bomber targeted a police vehicle outside the Jalalabad consulate, clearing the way for two assailants to enter a building next to the compound, according to Atta Ullah Khogyani, a spokesman for the Nangahar governor.

Security forces exchanged gunfire with the attackers for nearly three hours before overcoming them, officials said. Seven members of Afghan security forces, including two police officers, were killed, according to an Interior Ministry spokesman, Sediq Sediqqi. More than 10 people, including civilians, were wounded.

Until the Islamic State claimed responsibility Wednesday afternoon, it was unclear which group had mounted the attack. The Taliban regularly conducts such strikes against the Afghan government, international aid workers or foreign troops. But the Taliban’s main faction, led by Akhtar Mohammad Mansour, denied involvement.

The Taliban has also distanced itself from the attack on the Indian Consulate in Mazar-e Sharif on Jan. 4 in which Afghan security forces repelled a group of gunmen attempting to lay siege to the facility. Three attackers and a police officer died in the day-long standoff, which came a week after Indian Prime Minister Narendra Modi visited Afghanistan.

Wednesday’s attack was seen by some as an attempt to punish Pakistan for its prominent role in planning peace talks.

“Many terrorist groups might not see peace as being in their best interests,” Mahmood said.

Two other attacks also roiled the region Wednesday. In the Pakistani city of Quetta, an explosion outside a polio immunization center killed at least 14 people, most of them policemen. The Pakistani Taliban asserted responsibility. In the southern Afghan city of Lashkar Gah, a botched suicide bombing injured a civilian, according to local media.

Mohammad Sharif in Kabul and Haq Nawaz Khan in Peshawar, Pakistan, contributed to this report.

Read more:

The Islamic State is making these Afghans long for the Taliban

The chaotic war in Afghanistan

Today's coverage from Post correspondents around the world