The militants stormed into the army base — the Corps 215 Maywand in Shorab area of Helmand — at early hours of Friday, said an army source.
“Afghan soldiers of 215 Maiwand Corps stopped the Taliban from gaining control of the military compound, we have reports that six Afghan soldiers were killed during the clashes," a senior Afghan security official told Reuters on condition of anonymity, Presstv Reported.
Security sources said members belonging to foreign forces present at the base were safe as the Taliban could not breach walls of their compound.
According to a report by local Tolo News TV, some 21 militants were involved in the attack. Provincial and defense officials said at least four assailants were killed.
"Three suicide bombers detonated their explosive belts and six militants were shot dead by army soldiers," the report said.
It also said that several army troops were wounded during the gunfight.
"Right now, the Afghan commando forces are carrying out a clean-up operation in the area," said Omar Zwak, a spokesman for the provincial governor.
US forces spokesman Colonel Dave Butler also confirmed the attack in a Twitter message, saying, "The attack was repelled by the brave Afghan Security Forces."
"Taliban fighters were initially able to gain access to the Afghan base but were stopped by Afghan forces,” he said later.
The Taliban claimed responsibility for the attack.
According to a senior security official in the capital Kabul, the attack was Taliban's third attempt to overrun the strategic military installation in the past 48 hours.
The attack came amid a halt in the ongoing peace talks between the Taliban and the US in the Qatari capital, Doha
The talks, which were kicked off with the presence of the Taliban political chief Mullah Abdul Ghani Baradar and US Special Representative for Afghanistan Zalmay Khalilzad in Doha on Monday, are expected to revolve around the agreements reached last month between the two sides for ending the 17-year-old conflict in Afghanistan.
They will resume the negotiations over the weekend.
In the meantime, The New York Times reported that according to a Pentagon plan, the US has offered to pull out all its forces from Afghanistan over the next three to five years.
The rest of the US-led international forces in Afghanistan would leave at the same time, the Times said on Thursday.
The plan, which is currently being discussed with European allies, also calls for cutting by half, in coming months, the 14,000 US troops currently in Afghanistan.
The United States invaded Afghanistan in October 2001 and overthrew a Taliban regime in power at the time. But US forces have remained bogged down there through the presidencies of George W. Bush, Barack Obama, and now Donald Trump.
Taliban have repeatedly said the presence of foreign troops is the biggest obstacle to peace in Afghanistan.