A homicide bomber drove his explosives-packed vehicle toward an army convoy but soldiers opened fire, unleashing an explosion that wounded four troops and killed the attacker in volatile northwest Pakistan Thursday.

The attack occurred in Bara town, not far from North West Frontier Province's main city, Peshawar, said government official Hafeez Khan.

The four troops wounded in the blast were in stable condition in a hospital, a military statement said.

Also, the military said Thursday a homicide bomber blew himself up and wounded two troops as they conducted a raid on an insurgent hide-out in the Swat Valley. Another militant also died in the explosion, it said in a statement.

The northwest has seen a spate of recent attacks. Twenty-two people were killed and more than 150 wounded last Saturday in two suicide car bombings.

Pakistan is battling Al Qaeda and Taliban militants close to the Afghan border blamed for scores of attacks over the last two years. The insurgents are linked to those in Afghanistan, where violence against NATO and U.S. troops is running at record levels.