Abu Huraira reported the Prophet as saying, “I am nearer to the believers than themselves, so if anyone dies leaving a debt without leaving enough to pay it I shall be responsible for paying it, and if anyone leaves property it goes to his heirs.” A version has, “If anyone leaves a debt or children without maintenance let the matter come to me, for I am his guardian.” Another version has, “If anyone leaves property it goes to his heirs and if anyone leaves dependents without resources they come to us.”
(Bukhari and Muslim.)