Abu Huraira reported God’s messenger as saying, “Walk quickly at a funeral, for if the dead person was good it is a good condition to which you are sending him on, but if he was otherwise it is an evil of which you are ridding yourselves.”
(Bukhari and Muslim.)