He became Muslim then he left Islam
Apostasy (riddah) means disbelieving after being Muslim. There is no bad deed that cancels out all good deeds apart from apostasy. If a person dies in a state of apostasy all his good deeds will be wiped out, but if he returns to Islam, the reward for his good deeds will be restored and he does not have to make up any prayers or fasts that he missed during the period of his apostasy.
Shaykh al-Islam [Ibn Taymiyah] said:
With regard to apostasy from Islam, whereby a person becomes a kaafir, whether a mushrik or a Jew or Christian, if he dies in that state then all his good deeds will be wiped out, according to scholarly consensus, as the Qur’aan says in more than one place. For example Allaah says (interpretation of the meaning):
“And whosoever of you turns back from his religion and dies as a disbeliever, then his deeds will be lost in this life and in the Hereafter”
“And whosoever disbelieves in Faith, [i.e. in the Oneness of Allaah and in all the other Articles of Faith i.e. His (Allaah’s) Angels, His Holy Books, His Messengers, the Day of Resurrection and Al-Qadar (Divine Preordainments)], then fruitless is his work”
“But if they had joined in worship others with Allaah, all that they used to do would have been of no benefit to them”
Majmoo’ al-Fataawa, 4/257, 268)
With regard to the shar’i rulings on apostates, if the apostate does not return to Islam, he must be executed.
It was narrated that ‘Abd-Allaah ibn Mas’ood said: the Messenger of Allaah (peace and blessings of Allaah be upon him) said: “It is not permissible to shed the blood of a Muslim who bears witness that there is no god except Allaah and that I am the Messenger of Allaah except in one of three cases: a soul for a soul (i.e., punishment for murder), a married man or woman who commits adultery, and one who leaves his religion and separates from the jamaa’ah (main body of Muslims).”
Narrated by al-Bukhaari, 6484; Muslim, 1676
It was narrated that Ibn ‘Abbaas said: the Messenger of Allaah (peace and blessings of Allaah be upon him) said: “Whoever changes his religion, execute him.”
(Narrated by al-Bukhaari, 6922).
Then if he is executed, he has died as a kaafir, so he is not to be washed or shrouded; the funeral prayer is not to be offered for him, and he is not to be buried in the Muslim graveyard. On the Day of Resurrection he will be one of the people of Hell who will abide therein for eternity.
The earth rejected the body of an apostate during the time of the Prophet (peace and blessings of Allaah be upon him), as a lesson and a warning to the onlookers.
It was narrated that Anas (may Allaah be pleased with him) said: There was a Christian man who became Muslim. He used to recite al-Baqarah and Aal ‘Imraan, and he used to write down (the revelation) for the Prophet (peace and blessings of Allaah be upon him). Then he returned to Christianity and he used to say, “Muhammad knows nothing but what I have written for him.” Then Allah caused him to die, and the people buried him, but in the morning they saw that the earth had thrown his body out. They said, “This is the doing of Muhammad and his companions. They dug the grave of our companion and took his body out of it because he had run away
from them.” They again dug the grave deeply for him, but in the morning they again saw that the earth had thrown his body out. They said, “This is the doing of Muhammad and his companions. They dug the grave of our companion and threw his body outside it, for he had run away from them.” They dug the grave for him as deep as they could, but in the morning they again saw that the earth had thrown his body out. So they realized that what had befallen him was not done by human beings and they had to leave him thrown (on the ground).
Narrated by al-Bukhaari, 3421; Muslim, 2781.
And Allaah knows best.