Militants ambushed an Afghan military patrol in a Taliban (search) stronghold Tuesday, sparking a three-hour gunbattle that left four troops and two rebels dead, an Afghan official said.

The incident was just the latest in a string of attacks and killings blighting the runup to the country's historic presidential election on Oct. 9.

The ambush was laid by about 20 gunmen who opened fire on 30 militia soldiers riding pickup trucks through Nawbahar, a mountainous district of Zabul province, deputy police chief Jailani Khan said.

"It was a Taliban ambush," Khan said. "They fought it out for three hours with AK-47s and machine-guns until the enemy retreated into the hills."

Two militants were killed and two more captured, he said. Four of the Afghan militia soldiers died.

Zabul is a hotbed of the Taliban-led insurgency roiling parts of the south and east of the country despite the presence of 18,000 American-led troops.

the rebels have threatened to disrupt the country's first national election since the Taliban's ouster almost three years ago, and officials warn that violence could surge in the next two weeks, also in the relatively peaceful capital.

"We will do what we can to tighten security during the elections and protect the poor people," Khan said.

In another incident, Khan said that the driver of former Zabul Gov. Hamidullah Tokhi (search) had been beheaded in an attack in the province on Monday.

Khan blamed the Taliban, though provided no evidence to show that the deadly factional rivalries that also plague the region were not behind the slaying.