A Muslim is permitted to attend the funeral Prayer of non-Muslims. However, there are certain precautions that should be taken into consideration such as participation in any religious ritual for the janazah as well as making any istighfar for the dead non-Muslim. Both acts are forbidden for a Muslim. Thus, a Muslim is permitted to attend the funeral prayer as a show of courtesy with non-Muslims.
Sheikh Faysal Mawlawi, deputy chairman of the European Council for Fatwa and Research, states the following: In principle, there is nothing wrong in attending the funerals of non-Muslims and offering condolences to them.
In certain occasions, attending funerals serves as a means of showing peaceful coexistence with non-Muslims, which is recommended. Allah Almighty says, (Allah forbiddeth you not those who warred not against you on account of religion and drove you not out from your homes, that ye should show them kindness and deal justly with them. Lo! Allah loveth the just dealers.) (Al-Mumtahanah 60: 8)
however, a Muslim is required to be cautious when attending such funerals and he is not allowed to reiterate the phrases uttered by non-Muslims in the funeral procession, at their cemeteries or even in the way he offers his condolences.