The rocket attack in Kabul came days after President Ashraf Ghani offered the Taliban a reciprocal ceasefire to mark the Islamic Eid al-Adha holiday. The "Islamic State" claimed credit for the assault.
Militants fired a barrage of rockets on the Afghan capital's diplomatic quarter and struck near the presidential palace on Tuesday, before an hours-long battle involving helicopter gunship airstrikes left at least two insurgents dead.
The attack came as President Ashraf Ghani delivered a message to the Afghan people to mark the start of the Islamic Eid al-Adha holiday, and only days after he offered a conditional ceasefire with the Taliban.
One rocket landed somewhere near the presidential palace, while another hit near a NATO compound and the US Embassy. At least 20 rockets were fired toward the diplomatic quarter, said General Murad Ali Murad, adding that six people including security forces were injured.
The explosions were heard during the live broadcast of Ghani's speech. As he heard the booms, Ghani interrupted his message to say: "If they are thinking the rocket attack will keep Afghans down, they are wrong."
There was no immediate statement from the Taliban, but its rival the "Islamic State" later claimed credit for the attack.
Police responded with helicopter gunships and bombed a house near the central Eidgah Mosque from where the rockets were reportedly launched. At the scene, eyewitnesses said that after the explosions, sporadic gunfire could be heard from the area, though it was not clear who was firing.
The area in Kabul where the rockets hit is one of the most secure in the Afghan capital. Embassies and government buildings are located in the area, surrounded by high cement blast walls and coils of razor wire. Many streets near the US Embassy are closed off, as well as those near sensitive government and military locations.
However, the assault on the major Muslim holiday sent a stark message and was another blow to Ghani's efforts to bring the insurgents to the negotiation table and hold peace talks to end the country's 17-year war.
On Sunday, Ghani had offered a conditional ceasefire to last during the holiday, saying it would only take effect if the Taliban reciprocated.
Afghan forces on Monday rescued nearly 150 people, including women and children, just hours after the Taliban ambushed a convoy of buses and kidnapped them in northern Kunduz province.
The rapid response marked a rare if limited battlefield success for the troops after weeks of unrelenting insurgent attacks.
Earlier this month, insurgents had launched a coordinated assault on Ghazni, a strategic city roughly 120 kilometers (75 miles) from Kabul. They seized several neighborhoods; it took security forces, with assistance from US airstrikes and advisers, more than five days to drive them out.
On Saturday, Taliban leader Maulvi Haibatullah Akhunzadah, ahead of the Eid al-Adha holiday, released a message saying there would be no peace in Afghanistan as long as the "foreign occupation" continues and reiterated that the group will only negotiate directly with the US.
The Taliban and US diplomats reportedly met in Qatar earlier this month in a bid to restart peacetalks.
Russian Foreign Minister Sergei Lavrov said Tuesday that the Taliban would likely attend a Afghanistan conference in Moscow in early September, in which the Afghan government will take part.
NATO and the US officially ended their combat mission at the end of 2014 but remain in the country for training and support purposes, and have repeatedly come to the aid of Afghan forces in recent years to prevent Taliban advances.
cw,av/msh (AFP, AP, Reuters)