Militants have fired mortars at the diplomatic quarter of the Afghan capital Kabul during a speech by the president to mark a Muslim holiday.

President Ashraf Ghani was speaking live on television to celebrate Eid al-Adha when explosions were heard near the presidential palace.

A combat helicopter later fired on a building where militants were believed to have taken up position.

Mr Ghani's call for an Eid ceasefire was rejected by the Taliban on Monday.

As troops secured the area targeted, it was still not clear who had fired the mortars or how many attackers were involved.

After several hours officials said all the attackers had been killed. Four other people were wounded, two of them security personnel.

Separately, officials said the Taliban had released more than 160 bus passengers kidnapped a day earlier in the north. At least 20 soldiers and policemen were still being held.

Militants from both the Taliban and Islamic State group have carried out attacks in Afghanistan this month that left hundreds of people reported dead.

Where were the mortars launched from?
A Kabul police chief told the BBC that three attackers armed with a heavy machine gun and a mortar had broken into a building behind Kabul's Eid Gah Mosque.

According to the police chief, the attackers first used the mortar against the presidential palace.

At least 10 explosions were heard in the background as President Ghani was delivering his Eid message. Television images showed dark smoke rising into the sky.

Security forces then exchanged fire with militants in the building.

How bad is the violence?
The Taliban have launched several attacks in recent weeks.

The largest was an assault on the city of Ghazni, east of Kabul, which sparked a five-day battle with government forces that left hundreds dead or wounded. The UN has warned that up to 150 civilians may have been killed.

The attacks come as pressure continues on the Taliban to enter peace talks with the Afghan government.

Secret talks were recently held in Qatar between Taliban and US officials after an unprecedented three-day ceasefire during Eid al-Fitr celebrations in June that was largely respected by both sides.