Militants have launched a suicide attack on a US base in eastern Afghanistan but failed to breach the outside gate.
The four militants were all killed in the attack on the base in the Rakha district of the Panjshir region, officials said.
There are unconfirmed reports two Afghan drivers were also killed.
The compound serves as the base for a provincial reconstruction team - a mix of military and civilian personnel.
The Taliban said they carried out the attack.
The militants struck the gate of the base with rocket-propelled grenades and detonated a vehicle containing explosives.
Two security guards were wounded.
Provincial police chief Mohammad Qasim Jangalbagh told Agence France-Presse that two drivers bringing fuel to the base had been killed.
Nato confirmed the attack but said there were no US deaths or injuries.
"There was a complex attack attempted, but it was repelled," spokeswoman Capt Ebony Calhoun said.
Foreign troops are scheduled to leave Afghanistan by 2014, handing over control of security to Afghan forces.
Separately, a US drone strike along the Afghan border area late on Friday killed four militants in Baghar, 40km (25 miles) west of Wana, the main town of Pakistan's South Waziristan region, Pakistani officials said.