The capture of the troops has been an embarrassment for Pakistan 's army as it struggles to contain a recent upsurge in violence near the Afghan border .