Abu Hurairah reported,

The Messenger of Allah ﷺ used to be brought a deceased man who owed a debt. He would ask, "Did he leave anything to settle his debt?" If he was told that the man had left enough to repay it, he would pray over him. Otherwise, he would say, "Pray over your companion yourselves."When Allah granted him the conquests, he said, "I am closer to the believers than they are to themselves. Whoever dies leaving a debt, its repayment is upon me, and whoever leaves wealth, it belongs to his heirs."

Azami 6043

Sahih

عن أبي هريرة

أن رسول الله ﷺ كان يؤتى بالرجل الميت عليه الدين، فيسأل: هل ترك لدينه من قضاء؟ فإن حدث أنه ترك وفاء صلى عليه، وإلا قال: صلوا على صاحبكم. فلما فتح الله عليه الفتوح قال: أنا أولى بالمؤمنين من أنفسهم، فمن توفي وعليه دين فعلي قضاؤه، ومن ترك مالا فهو لورثته.

الأعظمي 6043صحيح
Contents
Reference
Commentary
Ayat
Collection
Jami al-Kamil
Book
Obligatory duties
Section
He who leaves wealth, it is for his heirs
Numbering
Jami al-Kamil 6043 (2nd edition)
Azami 6043