An hours-long battle in the Afghan capital involving insurgent rocket attacks and military airstrikes ended Tuesday with the death of two militants, authorities said.
The assault came as President Ashraf Ghani was making a speech marking the first day of the Islamic Eid al-Adha holiday, days after he offered the Taliban a conditional three-month ceasefire. It was not clear who carried out the attack.
"Two attackers were involved. The enemy was firing mortars," General Murad Ali Murad, commander of Kabul's garrison, told a press conference.
They were killed and at least six civilians or security force members were injured, he said.
Police said the attackers used rockets, several of which landed in at least two areas of Kabul around 9:00 am.
During the battle an Afghan army helicopter swooped in low near the Eidgah Mosque in a central district and fired a rocket at a militant position, sending a plume of dust into the sky.
Shoppers who moments earlier had been buying livestock for the Eid feast sprinted for shelter as cars swerved in the road to flee the fighting. Blasts and gunfire could be heard as security forces cordoned off the area.
The mosque is near the presidential palace where Ghani was making his speech, which was being aired live on Facebook when the attack began.
The president can be seen pausing as multiple blasts are heard in the background, some sounding nearby, before stating: "This nation is not going to bow to these rocket attacks."
The attackers appeared to be in a building behind the mosque, which was partially destroyed in another attack several years earlier and is not believed to have been in use for Eid.
Footage aired during the attack on Tolo News showed black smoke emanating from the area near the mosque while fire trucks and security vehicles rushed to the scene.
Interior ministry spokesman Najib Danish confirmed that militants had taken over a building near the mosque and fired several rockets.
Danish later told Tolo the militants were using rocket-propelled grenades and mortars to target parts of the city.
"Choppers are flying over the site and the security forces are busy defusing two explosives-packed vehicles," wrote interior ministry strategic communications chief Bahar Mehr on Facebook.
Ghani unveiled the government's latest ceasefire offer during an Independence Day address late Sunday, saying security forces would observe the truce beginning this week -- but only if the militants reciprocated.
The offer was welcomed by the United States and NATO after nearly 17 years of war, though it was not clear if their forces in Afghanistan would also participate.
The Taliban have not yet officially responded to Ghani's proposal.
The move followed an extraordinarily violent week in Afghanistan that saw that Taliban storm the provincial capital of Ghazni -- just a two-hour drive from Kabul -- and press the fight against security forces across the country, with estimates suggesting hundreds of people may have been killed.
Analyst Nazar Sarmachar said the proximity of the rockets to the presidential palace as Ghani was speaking highlighted glaring security shortcomings in the capital.
"Had a rocket landed in the backyard of the palace ... it could have killed or wounded the president," he said.
The truce proposal came after an initial ceasefire in June, the first since the US-led invasion in 2001 that toppled the Taliban regime.
For three days thousands of insurgents poured into cities across Afghanistan, eating ice cream and posing for selfies with security forces to celebrate.
The brief respite spurred hopes that a new path was opening for possible peace talks in the country.
The Taliban have long insisted on direct talks with Washington and refused to negotiate with the Afghan government, which they see as illegitimate.
In June Washington indicated a change in its longstanding policy, with US officials meeting Taliban representatives in Doha in July.
However, State Department official Alice Wells told AFP Monday that any future peace talks must include the Kabul government, and would not take place directly between the Taliban and Washington.