Dozens of insurgents were also killed in hours of fighting sparked after Sunday's dawn assault on a newly-built NATO and Afghan army post in the mountainous northeastern province of Kunar, the NATO-led force said.
The attack was one of the deadliest involving international forces who arrived in Afghanistan after a US-led invasion drove the Al-Qaeda-linked Taliban from government in late 2001.
Fifteen US soldiers and four Afghan troops were wounded, officials said.
"It was a well-organised attack, it was a ferocious attack," said Captain Mike Finney, a spokesman for the NATO-led International Security Assistance Force.
"The troops in the combat outpost fought back hard to make sure the insurgents did not overrun the place."
Hours of fighting, including air strikes, prevented the militants from taking over the base, with rebel casualties in the "high double figures", said Finney.
Between 400 and 500 militants from various anti-government factions including Taliban, Al-Qaeda and the Hezb-i-Islami faction were involved, a senior Afghan defence ministry official said on condition of anonymity.
"They attacked the newly established base there and reached even its walls. At one point they had entered the base," he said, citing information from the ground.
"I don't know if the soldiers died inside the base or outside but the enemy had reached the walls."
Troops were able to push them back with ground fighting and attack helicopters.
"Reports we got from the area suggest that about 40 enemy were killed and around the same number of them were wounded," he said.
ISAF's Finney said between 100 and 150 Afghan and international troops had moved into the outpost, near the village of Wanat, less than a week earlier.
Finney would not give the nationalities of the ISAF troops killed in the attack, but a Western official confirmed on condition of anonymity that they were all US nationals.
Americans form the bulk of the nearly 70,000 international troops in Afghanistan to help the fragile government fight back an insurgency led by the hardline Taliban, who were ousted in a US-led invasion in late 2001.
The attack in Kunar, which adjoins Pakistan -- where Afghan officials say insurgents are based, was one of the deadliest incidents for international forces in Afghanistan in years.
In June 2005, a rocket-propelled grenade brought down a Chinook helicopter in Kunar, killing 16 US soldiers. In September 2006, 14 British servicemen were killed when a Nimrod spy plane crashed in Helmand in the south.
Another international soldier was killed in Afghanistan on Sunday in a bomb blast in Helmand, the separate US-led coalition announced. The nationality of the soldier has not been released.
Sunday's deaths took to 133 the number of foreign soldiers killed in Afghanistan this year amid a spike in the insurgency-linked violence.
The past weeks have seen several deadly incidents across the country as the extremist insurgency has intensified and troops have stepped up their operations.
The coalition said Sunday it had killed 40 militants in a two-day operation in Helmand.
The same day a suicide attack targeted at police in Uruzgan province killed 24 Afghans, most of them civilians in a bazaar, police said.
A suicide bomber attacked the Indian embassy in Kabul a week ago, killing at least 41 people. The Indian ambassador, Jayant Prasad, said more than 60 people were killed but this was not confirmed by Afghan officials.
Afghan investigations have found meanwhile that coalition air strikes in the first week of July together killed 64 civilians. The coalition says only rebels died but it is investigating.
© 2008 Agence France Presse