Shaheed, as a term of Islamic religious literature is one who spends his life in the struggle of uplifting the word of God and even sacrifices his life. Obviously this person must be obeying all the religious injunctions. Even then we cannot testify that such and such person got the status of Shaheed when he died in the battlefield fighting against the enemies of God since nobody could determine his true motives. We the Muslims commonly become sentimental and don’t turn to our religious sources to see what they have to say. We tend to term every person shaheed who is near and dear regardless of his or her association to the truth.
If someone is killed in open war declared by an Islamic state then nobody can raise any objection on our saying him a Shaheed. If he violated any or some of the divine laws then we should only hope God forgives him rather than making a model of him to follow.