(Adds police quotes, details, background, paragraphs 3-5, 7-11)
By Mirwais Harooni and Abdul Saboor
KABUL, July 17 (Reuters) - Explosions and bursts of gunfire were heard near Kabul International Airport in the Afghan capital after dawn on Thursday and black smoke rose above the facility, which is used by civilians and the military.
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.
Officials said a number of militants had burst into a building just north of the airport but were quickly surrounded by Afghan forces.
"A number of insurgents have climbed a building (outside) and are shooting at Kabul airport," said Hasmat Stanekzai, a spokesman for Kabul police.
"The airport is undamaged and insurgents are surrounded by (Afghan forces). There are no reports of casualties and it is unclear how many insurgents are involved."
NATO forces said they were aware of reports of an attack on the airport but could not give more details.
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.
There was no immediate claim of responsibility.
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 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 said he could see black smoke billowing above the airport and heard several explosions from what sounded like rocket-propelled grenades. A car had been set on fire not far from the scene.
Sediq Sediqqi, a spokesman for the Interior Ministry, said a rapid response force had been sent to the area.
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)