What is the ruling on a non-mahram man placing a woman in her grave?
Question

Is it permissible for a non-mahram man to place a woman in her grave when her mahrams are present?
Praise be to Allah.There is nothing wrong with a man placing a woman in her grave even if he is a non-mahram to her. The Sunnah indicates that that is permissible.
Al-Bukhari (1285) narrated that Anas (may Allah be pleased with him) said: We attended the funeral of a daughter of the Messenger of Allah (blessings and peace of Allah be upon him) [who had died]. The Messenger of Allah (blessings and peace of Allah be upon him) was sitting at the graveside, and I saw his eyes flowing with tears. He said: “Is there any man among you who did not have intercourse with his wife last night?” Abu Talhah said: Me. He said: “Then get down,” and he got down into her grave [to receive her body and place it in the grave].
Shaykh Ibn ‘Uthaymin (may Allah have mercy on him) said: Some people think that no one should place a woman in her grave unless he is one of her mahrams. This is not correct. The one who knows best how burial is to be done should place her in her grave, whether he is one of her mahrams or not."(Liqa’ al-Bab al-Maftuh, no. 7).
He also said: Any man may place a woman in her grave, whether he is one of her mahrams or not, but it is better if it is one of her mahrams."(Liqa’ al-Bab al-Maftuh, no. 133).
Shaykh Muhammad ibn Ibrahim (may Allah have mercy on him) said: There is nothing wrong with a non-mahram placing a woman in her grave and undoing the ties of her shroud, even if a mahram is present."(Fatawa ash-Shaykh Muhammad ibn Ibrahim  3/157).
Ibn Hazm said: The man who is most entitled to place a woman in her grave is one who did not have intercourse the night before, even if he is a non-mahram, regardless of whether her husband and male relatives (walis) are present or not."(Al-Muhalla  3/370).
And Allah knows best.