By Mirwais Harooni and Abdul Saboor
KABUL, July 17 (Reuters) - Militants armed with rocket-propelled grenades attacked Kabul International Airport in the Afghan capital on Thursday in one of the most audacious assaults on the facility, used by both civilians and the military, in a year.
The attack on the airport comes at a time of great uncertainty for Afghanistan as votes from the second round of a disputed presidential election are to be recounted. The poll is meant to mark Afghanistan's first democratic transfer of power.
The attack lasted about four hours after four unidentified militants armed with automatic rifles and rocket-propelled grenades opened fire on the airport from the roof of a building just to its north.
"Four terrorists were killed by police special forces. The area is being cleared now, there are no casualties to our forces," said Interior Ministry spokesman Sediq Sediqqi.
The airport is home to a major operational base for NATO-led forces that have been fighting Taliban and other insurgents for 12 years and is bristling with soldiers and police, guard towers and several lines of security checkpoints.
Militants fire rockets into the airport almost every week, causing little damage, but frontal attacks on the heavily guarded facility are rare and represent an ambitious target for insurgents.
The attack was similar in tactics to last year's assault on the airport, when seven Taliban insurgents including suicide bombers attacked after taking up positions inside a partially constructed building nearby.
There was no immediate claim of responsibility for the latest attack.
A Kabul airport official told Reuters all flights had been diverted to other cities. In such circumstances, passenger planes are immediately diverted to other Afghan cities such as Mazar-i-Sharif in the north or Herat in the west.
"Due to the closeness of the attack to the runway, Kabul airport is now closed to all flights," the official said. Planes could be heard circling above Kabul as the attack unfolded.
A Reuters witness near the scene earlier saw black smoke billowing above the airport and heard several explosions. A car had been set on fire not far from the scene.
On Tuesday, a car bomb detonated in a crowded market killed 43 people and wounded at least 74 in the eastern province of Paktika, close to Afghanistan's porous border with Pakistan. (Writing by Maria Golovnina; Editing by Paul Tait)