Defence Minister Abdul Rahim Wardak had just left Kabul airport at 9.25am (0455 GMT) in a helicopter when his car was fired on by four men in combat uniform, ministry spokesman General Mohammed Zahir Azimi said.
The minister was unhurt.
Nine suspects, all Afghan soldiers, were arrested in connection with the shooting, Azimi said.
"It is clear that it was an assassination attempt on the defence minister," he said.
He added that four bullets hit the convoy as it was driving out of the airport, one of them "hitting the exact place where the defence minister had been sitting in the car".
A senior government official speaking on condition of anonymity, said the armed men were Afghan army soldiers angered by a pay dispute.
Hours later, a helicopter crashed at Wardak's destination in the Panjshir Valley north of Kabul, where senior officials were attending a ceremony commemorating the assassination of anti-Taliban leader Ahmed Shah Massood four years ago.
Army chief Bismillah Khan and Sediqa Balkhi, minister for the
disabled, were slightly injured in the crash, according to presidential spokesman Karim Rahimi.
Defence ministry spokesman Azimi said Wardak was not on board the aircraft that crashed. His helicopter returned to Kabul without incident.
The Taliban are opposed to
elections in Afghanistan
He denied reports that it had been fired on and said it crashed when its rotor blades hit a tree, shortly before noon.
"While an Afghan helicopter was landing in Panjshir, its rotor blade touched a tree and the helicopter fell to one side. Since it was very close to the ground no one was wounded or killed," Azimi said.
"It was definitely an accident," he added.
However, presidential spokesman Rahimi said the helicopter was taking off when it crashed.
"The chopper crashed while taking off. Bismillah Khan and the minister for the disabled were on board. According to initial
reports one of the pilots and the ministers have been slightly
injured," he said.
Meanwhile, Afghan and US-led forces killed 30 suspected fighters and arrested at least 60 others during an offensive in a southern province, the Defence Ministry's Azimi said on Saturday.
The fighting took place on Friday in the Grishk district of the southern Helmand province, Azimi said.
He said "a large number" of suspected fighters were arrested and that 60 of them had been identified.
Afghan soldiers were collecting weapons in the area, including some that were lying in farms.
"We have seized lots of ammunition and weapons," Azimi said.
The offensive is the latest large-scale operation against Taliban fighters in volatile southern and eastern Afghanistan.
War-torn Afghanistan will next week hold its first parliamentary elections since the Taliban was toppled in late 2001 and it has vowed to subvert the polls.
The fighters have stepped up attacks across much of the country, leaving more than 1200 people dead in the past six months.