Officials say the militants captured the soldiers after heavy gunfire .