Hadith.5715 - It has also been narrated in another report: "Whoever dies and has no heir, his wealth belongs to his Hamshahrij," meaning the people of his town.
The author of this book, may Allah سبحانه وتعالى have mercy on him, explained: When the Imam is present and apparent, the wealth belongs to the Imam. However, when the Imam is absent, the wealth belongs to the people of his town, provided that he has no heir or closer relative than them by local association.