I work as a guard in a building

Q: I have worked as an accountant for the National Insurance Company of Egypt (life insurance) since 1981, and I have been receiving my salary + monthly bonus + overtime + annual profits bonus all these years. First, what is the religious ruling on this work? Second, what is the ruling on the above-mentioned payments? If they are not Halal (lawful), what is the ruling on the money earned from this job during this period, knowing that I want to offer Hajj (Pilgrimage) or free a slave in the cause of Allah (Exalted be He) from this money? I pray to Allah that you will reply to me as soon as possible, for I am very confused and worried. May Allah reward you with the best for benefiting us and all Muslims.

A: First, life insurance is a form of commercial insurance, and it is prohibited because it includes lack of knowledge, uncertainty and unlawful taking of others' money. Working for this company is impermissible for this is assisting in sin and transgression, and Allah (Exalted be He) forbids this in His (Glorified be He) Saying: Help you one another in Al-Birr and At-Taqwâ (virtue, righteousness and piety); but do not help one another in sin and transgression. (Part No. 15; Page No. 9)  Second, it is permissible to benefit from the salaries and money earned from working for this company before knowing of its impermissibility, for Allah (Exalted be He) says: So whosoever receives an admonition from his Lord and stops eating Ribâ (usury) shall not be punished for the past; his case is for Allâh (to judge) May Allah grant us success. May peace and blessings be upon our Prophet Muhammad, his family, and Companions.