A spokesman for Nato's International Security Assistance Force said that three rounds landed inside the base and one landed outside.

The wounded personnel were taken to the main hospital in Bagram for treatment.

Isaf said it was not known if any Afghan civilians living near the base were harmed in the attack.

The Taliban later claimed responsibility for the shelling through Zabiullah Mujahid, a spokesman for the group.

First US deaths

It is the first time US soldiers have been killed by hostile fire inside the Bagram base since troops came to Afghanistan in 2001 to overthrow the country's Taliban government.

In video


Karzai challenger calls for political change

More Videos...
Most forces at the base are American, but many other countries also have soldiers at the base.

Al Jazeera's correspondent in Kabul, David Chater, reported: "It could have been long-range mortars. There are so many targets there it is not surprising there were these deaths and injuries.

"The base is surrounded by a high mountain range and flat desert. There are plenty of areas where whoever launched this attack could have launched the rocket fire or mortars from.

"But it's very rare to have these kind of attacks. We don't know yet who has carried it out.

"In a way it's saying to the US forces and international troops 'we can reach you wherever you are, even in your most heavily defended base'."

Campaigning began last Tuesday in Afghanistan's presidential election, due to be held on August 20.

Forty-one candidates are standing for the five-year term, including Hamid Karzai, the incumbent president.

Our correspondent reported that there had been a rise in violence since the official launch of campaigning.

"Just about all around Afghanistan we are getting reports of Taliban attacks," he said.

"They are reaching the highest level we have seen since the invasion in 2001, so this is a great concern for the election."