However, according to Reuters, a spokesman for the United States military command in Kabul denied reports by an Afghan official that Americans had been killed, but confirmed that an unspecified number of soldiers had been wounded at Camp Shaheen, which is the headquarters of the Afghan army's 209th Corps in the northern city of Mazar-i-Sharif.
A spokesman for the Afghan Defense Ministry said "three foreign soldiers, possibly Americans" had been wounded during training at the base.
Afghan officials also confirmed the attack and that the attacker had been shot dead.
The NATO-led Resolute Support Mission said the attack occurred at Camp Shaheen, and the troops were evacuated for medical treatment.
Six U.S. troops have been killed by hostile fire in Afghanistan so far in 2017.
He said five members of the police were killed, although Taliban spokesman Zabiullah Mujahid claimed scores of police lost their lives in the attack. The Taliban claimed responsibility.
"Initial information shows three USA soldiers visiting the base were wounded", defence ministry spokesman Mohammad Radmanish told AFP, adding that the attacker had been gunned down.
Thousands of worldwide troops remain in the country to train and assist Afghan security forces as well as carry out counterterrorism missions.
So-called green-on-blue, or insider, attacks have been a recurring problem for the USA -led coalition, most recently on June 10 in the Achin District of eastern Nangarhar province, where US ground forces are helping Afghan special forces fight Islamic State extremists.
Nevertheless, these attacks fueled a strong sense of mistrust between the coalition soldiers and the Afghan military. He added that two other insurgents were killed by police, but a fight with one remaining attacker is ongoing.
"We are aware of an incident", the office said in a statement.
In the deadliest attack in Achin in eastern Nangarhar province, three US soldiers were killed when an Afghan soldier emptied his automatic rifle in their direction.
Dana White, a spokesperson for the Pentagon, told NBC News that Defense Secretary James Mattis will present a revised military strategy to President Trump "in the coming weeks". The soldiers were assisting operations against the Islamic State in the restive eastern province of Afghanistan.
No US military troops were killed, the mission said in a statement.