Praise be to Allah.
Shaykh Muhammad ibn ‘Uthaymeen (may Allaah have mercy on him) said:
The one who is more entitled to do that is the one whom the deceased wanted to do that for him, if he expressed a preference. If he did not express a preference, then it should be the next of kin. If there is one who is knowledgeable then he is more entitled, and if there is no one who is knowledgeable, then he may learn from one who is knowledgeable, and the one who is knowledgeable may direct the one who has no knowledge to carry out this task.
It is not essential for the one who lowers the deceased into the grave to be a mahram of the woman. The Prophet (peace and blessings of Allaah be upon him) commanded Abu Talhah (may Allaah be pleased with him) to go down into the grave of his (the Prophet’s) daughter and bury her in his presence and in the presence of her husband ‘Uthmaan ibn ‘Affaan (may Allaah be pleased with him). (The hadeeth was narrated by al-Bukhaari, 1342).
Comment