Afghanistan has been facing increased violence since the insurgents launched their assault in early May, soon after the US-led foreign forces began their final withdrawal which is now almost complete.
Afghan forces have repelled a Taliban attack on the outskirts of Afghanistan's key western city of Herat, officials said, as the insurgents pressed on with their sweeping offensive.
The Taliban recently seized several districts around the city as well as two border crossings in the province along the frontiers with Iran and Turkmenistan as they continued with their deadly assault.
Violence has surged across the country since the insurgents launched their assault in early May, soon after the US-led foreign forces began their final withdrawal which is now almost complete.
Dozens of Taliban militants killed
"The Taliban fighters had launched attacks near the city of Herat in the district of Guzara last night," Jailani Farhad, spokesman to Herat provincial governor, told AFP.
"Fortunately, their attack was repelled by Afghan security forces, but unfortunately four members of Afghan security forces were killed."
Farhad said sporadic fighting continued in the district up until now, adding up to 40 Taliban militants had been killed in the fighting.
Both the Taliban and Afghan authorities exaggerate their battlefield and casualties claims, which are impossible to independently verify.
Afghan forces and militiamen of veteran warlord and anti-Taliban commander, Ismail Khan, were deployed around the city of about 600,000 inhabitants, an AFP correspondent reported.
Khan, who previously fought the Soviet occupation forces in the 1980s and then the Taliban during their hardline regime in the 1990s, has vowed to fight the militants again to counter their staggering advances in recent months.
The insurgents have captured an arc of territory stretching from the Iranian border to the frontier with China since launching their offensive in early May.
They have already captured scores of districts, border crossings and encircled several provincial capitals.