U.S. and allied troops backed by warplanes and helicopters fought dozens of militants Monday in the biggest border clash along the mountainous Pakistani border in months. At least two militants and two Afghan soldiers were killed.

Separately, an Afghan soldier was reported killed when gunmen ambushed his vehicle in southern Afghanistan (search) on Sunday as he returned from guarding officials registering voters for October's presidential election.

The border battle began shortly after midnight Sunday when militants armed with rockets and machine-guns attacked a military post in Khost, a former Al Qaeda (search) stronghold about 120 miles south of Kabul, Afghan commander Gen. Khial Baz said.

U.S. spokesman Maj. Rick Peat said more than 100 Afghan and American troops clashed with 50 militants in the area. A B1 bomber, two A-10 ground-attack aircraft and four Cobra helicopter gunships provided support, he said.

"The militants retreated in panic and were pursued by the attack aircraft," Peat said.

Four Afghan soldiers were wounded, two of them fatally, and troops found the bodies of two dead militants, Baz said. The rest of the attackers retreated into Pakistan (search), he said.

Four hours later, U.S. and Afghan forces, again supported by A-10s, fought about 20 militants in a renewed battle. "The militants retreated after incurring heavy losses," Peat said, without elaborating.

This time, one Afghan soldier was killed and three others wounded, he said.

A Taliban (search) spokesman, Abdul Hakim Latifi, said followers of the hardline Islamic militia ousted more than two years ago by U.S.-led forces had mounted the attack on the border post. He said four Afghan soldiers were killed.

Afghan and American military bases along the mountainous border regularly come under fire from rebels armed with rockets, mortars and guns, despite stepped-up efforts by thousands of Pakistani and U.S.-led troops to reinforce the frontier.

In March, seven Afghan soldiers were reported killed when suspected Taliban attacked their border post in southern Kandahar. Last December, U.S. troops and helicopters killed as many as 14 militants in Paktika province, just south of Khost.

Many of the attacks originate in tribal areas on the Pakistani side, where Pakistani forces recently mounted a string of operations in an attempt to dislodge hundreds of suspected foreign fighters. Scores of militants and soldiers have died.

In Afghanistan, militants have also targeted workers preparing landmark presidential elections set for Oct. 9, including a guard shot dead in the troubled south on Sunday.

The militia soldier was traveling back from a voter registration site to Lashkargah, the capital of Helmand province, on Sunday evening when his jeep came under fire, said Mohammed Wali, spokesman for the provincial governor.

Wali blamed the Taliban but did not elaborate.

At least 10 election workers have died in a string of attacks since May, but the violence has failed to halt a registration drive that the United Nations says has reached more than 90 percent of the estimated electorate so far.