KABUL, Afghanistan -- Gunmen carried out a pre-dawn rocket attack on Kabul International Airport on Thursday, temporarily shutting down the facility and setting off a gunbattle with security forces in which four attackers were killed, officials said.

The militants occupied two buildings which were under construction some 700 metres north of the facility, and were using them as a base to direct rockets and gunfire toward the airport and international jet fighters flying over Kabul, said Afghan army Gen. Afzal Aman.

Kabul Police Chief Mohammed Zahir Zahir later said four of the attackers were killed and that the attack was halted without any civilian or police casualties.

The airport was later reopened and operations returned to normal, Zahir said, after security forces inspected the runways for shrapnel and explosives.

The pre-dawn attack comes during a tense time in Afghanistan, as a recount is underway from the disputed second round of a presidential election seen as key to insuring a peaceful transfer of power ahead of the withdrawal of most foreign troops by the end of the year.

Taliban spokesman Zabihullah Mujahid claimed responsibility for the airport attack in a call to The Associated Press.

Aman said several rockets hit the airport but no planes were damaged.

The airport hosts civilian traffic and serves as a base for NATO-led forces that have been fighting the Taliban and other insurgents for more than a decade. Rocket attacks near the airport are not rare, but are not usually this close.

Alarms sounded at the U.S. Embassy in Kabul, as they usually do when there is an attack in the city, as ISAF jet fighters patrolled overhead.

The attack came nearly a week after U.S Secretary of State John Kerry helped broker a deal to carry out a full audit of last month's presidential runoff following allegations of fraud by supporters of both candidates.

Unofficial and disputed preliminary results showed former Finance Minister Ashraf Ghani Ahmadzai well ahead of his rival, former Foreign Minister Abdullah Abdullah, but Abdullah's supporters have said that is only because of widespread fraud.

Since fraud was alleged on both sides, the deal provides that every one of the 8 million ballots will be audited under national and international supervision over the next three or four weeks.

Neither the election nor the weekend deal has had any visible effect on security in the country, which has long seen near-daily attacks.

On Tuesday a suicide bomber blew up a car packed with explosives near a busy market and a mosque in eastern Afghanistan, killing dozens of people in one of the deadliest insurgent attacks on civilians since the 2001 U.S.-led invasion to topple the Taliban.