It has been narrated on the authority of Abu Qatada that the Messenger of Allah (may peace be upon him) stood up among them (his Companions) to deliver his sermon in which he told them that Jihad in the way of Allah and belief in Allah (with all His Attributes) are the most meritorious of acts. A man stood up and said: Messenger of Allah, do you think that if I am killed in the way of Allah, my sins will be blotted out from me? The Messenger of Allah (may peace be upon him) said: Yes, in case you are killed in the way of Allah and you were patient and sincere and you always fought facing the enemy, never turming your back upon him. Then he added: What have you said (now)? (Wishing to have further assurance from him for his satisfaction), he asked (again): Do you think if I am killed in the way of Allah, all my sins will be obliterated from me?
The Messenger of Allah (may peace be upon him) said: Yes, it you were patient and sincere and always fought facing the enemy and never turning your back upon him, (all your lapses would be forgiven) except debt. Gabriel has told me this.
Sahih Muslim, Book 20, Number 4646.