A homemade bomb carried by an Afghan man exploded prematurely before he boarded a bus in southwestern Pakistan on Sunday, seriously wounding him and two passers-by, police said.

The explosion happened at a bus terminal in downtown Quetta, capital of the Baluchistan province, said Zahid Afaq, a senior police official.

The bomber, identified as Mohammed Sayed from neighboring Afghanistan, was taken to a hospital in serious condition and was under police watch, Afaq said.

"He did not get the time to plant the bomb on the bus," Afaq told The Associated Press, adding the explosive device malfunctioned.

The motive for the failed attack was not immediately clear.

Afaq said the Afghan had been carrying the bomb in a pocket of his waist coat, part of the traditional attire for Afghan men.

Quetta is just 50 kilometers (30 miles) east of the Afghan border in the sparsely populated Baluchistan region, which has in recent years seen escalating bomb, rocket and land mine attacks, most linked to a local insurgency driven by demands for increased royalties for resources such as natural gas.