Dozens have been killed after Taliban militants ambushed Afghan security forces in the western province of Farah, sparking an hourslong gunbattle.

Farid Bakhtawar, head of the provincial council, said eight special forces and 10 police officers were killed in a predawn attack by the Taliban in the Bala Buluk district on March 10.

Bakhtawar said some 40 Taliban militants were also killed in the battle, which lasted around five hours.

He said air strikes were called in to support Afghan security forces.

Defense Ministry spokesman Dawlat Waziri said only four members of the Afghan special forces had been killed and a number wounded.

Taliban spokesman Zabihullah Mujhaid claimed responsibility for the attack.

At least 18 Afghan soldiers were killed after Taliban militants attacked a security checkpoint in Bala Buluk district on February 24.

On February 20, Taliban attacks on police checkpoints in Farah killed eight police officers. The provincial government said 13 militants were also killed in the fighting.

Farah Province, one of the poorest in the country, is situated on the border with Iran in the far west of Afghanistan.

Farah has experienced months of fighting, with some people accusing the security forces of collusion with Taliban militants involved in cross-border smuggling and drug trafficking.

On January 24, hundreds of people took to the streets of Farah, the provincial capital, protesting about the lack of security and calling on provincial leaders to resign. Six people were reportedly injured in the protests.

Some local officials have accused Iran of providing insurgents with funds, weapons, and explosives -- allegations that Iran denies.

The Kabul government has deployed hundreds of additional troops to Farah to thwart the Taliban's offensive.

The attack in Farah came just days after 17 Afghan soldiers were killed by Taliban militants in attacks on army checkpoints in the northern province of Takhar, on the border with Tajikistan.

The Taliban and the Islamic State militant group have stepped up their attacks on Afghan troops and police in recent months.

Afghan soldiers have taken what the United Nations describes as "shocking" casualties since international forces ended their combat role at the end of 2014, though troop casualty figures are no longer released.

With reporting by Reuters and AP