Smoke rises from the site of an attack near the presidential palace in Kabul, Afghanistan. (Reuters)

Terrorists rattled the Afghan capital Kabul Tuesday in an hours-long attack that saw parts of the city showered with mortar fire, sparking intense clashes with security forces who used air strikes to quell the assault.

The attack, claimed by the ISIS was near the presidential palace as President Ashraf Ghani was addressing the nation on the first day of the Eid al-Adha holiday, and came days after he offered the Taliban a conditional three-month ceasefire.

The clashes follow what has already been a bloody month in Afghanistan with the Taliban ramping up assaults on security forces across the country and ISIS targeting Kabul, with hundreds killed according to estimates.

Afghan police said the attackers launched up to 20 mortar rounds targeting four districts in central Kabul, after earlier statements claimed the Terrorists were firing rockets.

During the battle, an Afghan army helicopter swooped in low near the Eidgah Mosque in central Kabul and fired on the 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.

Ghani's speech was being aired live on Facebook when the attack began.

The president paused as multiple blasts were heard in the background, some sounding nearby, before stating: "This nation is not going to bow to these rocket attacks."

The attackers were 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.

Live TV footage of the attack showed black smoke emanating from the area, while fire trucks and security vehicles rushed to the scene. (Reuters)

An interior ministry spokesman, Bahar Mehr, said on Facebook that security forces were also defusing two explosives-packed vehicles during the fighting.

Analyst Nazar Sarmachar said the proximity of the attack to the presidential palace highlighted glaring security shortcomings in the capital.

"It could have killed or wounded the president," he said.

After the attack was over, officials issued conflicting statements over the number of militants involved. An Afghan general said two militants behind the attack were killed, while police said four were captured but mentioned none killed.

Kabul police spokesman Hashmat Stanikzai also said just six people had been wounded in the fighting.

A spokesman for US forces offered a third take, saying nine insurgents from two separate positions fired around 30 mortar rounds, with four killed and the other five surrendering to Afghan forces.

Ceasefire offer

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 Terrorists 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, and a spokesman said they had "nothing to do with" the attack on Kabul.

The group has not claimed an attack on the capital in months, despite engaging security forces across Afghanistan.

ISIS has claimed multiple assaults, however, including a devastating suicide blast inside a school last week which killed at least 37 people, the majority of them students. The group said Tuesday's attack had targeted "the presidential headquarters".

However, Kabul-based military analyst Ateequllah Amarkhail said he doubted whether ISIS had the ability to carry out such an assault.

"There have been suicide attacks carried out by Daesh in Kabul, but they are not capable of such a complex attack," he told AFP, using an Arabic acronym for IS.

Ghani's 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 taking celebratory selfies with security forces.

The brief respite spurred hopes a new path was opening for 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.