Taliban (search) militants crept up to an Afghan government office under cover of darkness early Wednesday and launched a gunbattle that left four attackers and three Afghan troops dead, police said.

Elsewhere, an explosion killed a motorcyclist in what an Afghan commander suggested was a botched suicide attack, and U.S. troops skirmished with insurgents near the Pakistani border.

The violence comes in the run-up to Afghanistan's Oct. 9 presidential election, which insurgents are trying to derail.

The mayor's office in Khaki Afghan, a district of southeastern Zabul province (search), was targeted Wednesday by rebels armed with machine guns and rifles, deputy police chief Jailani Khan said.

In four hours of fighting, four Taliban were killed and two more captured along with their weapons, Khan said. Three Afghan soldiers died and two were wounded.

"We are holding the bodies of the four dead Taliban," Khan said. Reports from the scene suggested there were also Arabs among the assailants, he said, but had no further details.

The motorcyclist was killed Tuesday in Khost province by an explosion which tore apart his body, set fire to his bike and injured a farmer riding a passing tractor, Gen. Fazel Mohammed Sahel said.

"He came across the fields and drove onto the main road near the police checkpoint," said Sahel. "There was a military vehicle driving toward him, and suddenly he blew up."

Sahel said the man appeared to be a suicide bomber, but that he had no idea why the explosion occurred on the open road or what kind of mission the dead man might have been on.

"We think he had explosives around his body. Half of him was simply gone," he said.

The commander said investigators identified pieces of one tank shell and found another unexploded round with a wire attached to it at the scene, just outside Khost city.

The American military said suspected Taliban shot at one of its patrols on Monday near Shkin, a border town in Paktika province where U.S. forces man a lonely base.

The patrol returned fire and pursued the assailants toward the nearby Pakistani border, where Pakistani forces tried to block their escape, spokesman Maj. Scott Nelson said.

American warplanes fired at the rebels, destroying a vehicle.

Fifteen local men detained for questioning were subsequently released, said another spokesman, Maj. Mark McCann. There were no reported casualties.

While the attackers apparently slipped away, the military said the operation was evidence of blossoming cooperation with Pakistan.

"This would never have happened a year ago," Nelson said. "We are exceptionally pleased by that and hope for a continued improvement."

Khost, Paktika and Zabul all lie in Afghan territory along the border where the Taliban-led insurgency against U.S. troops and the government of interim President Hamid Karzai (search) has been strongest.