All praise is due to Allah alone, and may peace and blessings be upon the Messenger of Allah, his family, and his companions. Some brothers have asked me the following questions:
Is growing the beard obligatory or merely permissible?
Is shaving it a sin or a breach of religious commitment?
Is it permissible to shave the beard while keeping the mustache? The answer to these questions is as follows:
It has been authentically reported from the Prophet May God bless him and grant him peace in both Sahih al-Bukhari and Sahih Muslim, on the authority of Ibn Umar (may Allah be pleased with them both), that the Messenger of Allah May God bless him and grant him peace said: "Trim the mustaches and let the beards grow; be different from the polytheists."
In Sahih Muslim, Abu Huraira (may Allah be pleased with him) narrated that the Messenger of Allah May God bless him and grant him peace said: "Trim the mustaches and grow the beards; be different from the Magians." Al-Nasa’i also reported in his Sunan with an authentic chain of narration from Zayd ibn Arqam (may Allah be pleased with him) that the Prophet May God bless him and grant him peace said: "Whoever does not trim his mustache is not one of us."
The great scholar and renowned hadith expert, Abu Muhammad Ibn Hazm, stated: "The scholars unanimously agreed that trimming the mustache and growing the beard is obligatory."
There are numerous hadiths and statements from scholars regarding the necessity of trimming the mustache, growing the beard, honoring it, and letting it grow. Due to the abundance of these narrations, it is difficult to cite them all in this message. However, based on the hadiths mentioned above and the consensus reported by Ibn Hazm, the answers to the three questions become clear:
The conclusion is that growing and maintaining the beard is obligatory, and it is not permissible to abandon it, because the Messenger of Allah May God bless him and grant him peace commanded it, and his command is obligatory, as Allah the Almighty said: "And whatever the Messenger has given you – take; and what he has forbidden you – refrain from." [Al-Hashr: 7]
Similarly, trimming the mustache is obligatory, and cutting it short is even better. However, keeping a long mustache or shaping it into styles is not permissible, as it contradicts the words of the Prophet May God bless him and grant him peace: "Trim the mustaches," "Shorten the mustaches," "Cut the mustaches," "Whoever does not trim his mustache is not one of us."
These four expressions all appear in authentic hadiths from the Prophet May God bless him and grant him peace. The last one, in particular—"Whoever does not trim his mustache is not one of us"—is a severe warning and a clear threat, which necessitates that a Muslim be cautious about what Allah and His Messenger have prohibited and hasten to fulfill what Allah and His Messenger have commanded.
From this, it is also understood that keeping a long mustache and shaving the beard are sinful acts and acts of disobedience, which weaken faith and may incur Allah's wrath and punishment.
The aforementioned hadiths also indicate that growing the mustache excessively and shaving or trimming the beard are acts of resembling the Magians and polytheists. It is well known that imitating them is an evil act that is not permissible, as the Prophet May God bless him and grant him peace said: "Whoever imitates a people is one of them."
I hope this answer is sufficient and convincing. Allah is the Granter of success. May peace and blessings be upon our Prophet Muhammad, his family, and his companions.