The army says it defended its post "vigorously" but eventually withdrew, as militants seized on their base.