A spokesman for the 207 Zafar military corps, Najibullah Najibi, said the fighting lasted five hours, with 11 soldiers and six Taliban killed.
Afghan security forces have suffered a high number of casualties since the Taliban stepped up attacks across the country since the start of their spring offensive.
Most foreign troops withdrew from Afghanistan when NATO combat operations against the Taliban ended last year.
More about: