The Israeli army has killed three captives held by Palestinian armed groups in Gaza after mistakenly identifying them as a threat, according to Israeli military officials.