A wife donating all her inheritance from her husband as a Waqf on his behalf

Q: A man died and left his wife 450,000 riyals, which was monetary compensation for a house he inherited from his mother. The deceased was barren; he had no children. He did not even have agnates and his only heir is his wife, who wants to spend the money on building a Masjid (mosque) as waqf (endowment) for the sake of Allah on behalf of her late husband, mother-in-law, and herself. Is it permissible for her to do this according to the Shari`ah (Islamic law) or not?

A: If the reality is as mentioned, it is permissible because this is a charitable way of disposition. May Allah grant us success. May peace and blessings be upon our Prophet Muhammad, his family, and Companions.