Foreigners in Somalia are allowed to celebrate Christmas in their own homes, but hotels and other public places are barred from partaking in any events related to the Christian holiday. Photo: Adek Berry/AFP/Getty Images

The Somali government on Tuesday banned celebrating Christmas and ordered security forces to stop any public gatherings from observing the Christian holiday. Religious leaders said such festivities could threaten the East African country’s Muslim community and inspire attacks from al-Shabab insurgents.

“Those celebrations are not in any way related to Islam,” Sheikh Mohamed Khayrow, director general of Somalia’s Ministry of Religious Affairs, said Tuesday, according to BBC News.

Foreigners in Somalia are allowed to celebrate Christmas in their own homes and peacekeepers are also free to mark the holiday at United Nations and African Union compounds. However, hotels and other public places are barred from partaking in any events related to Christmas and New Year celebrations, which officials said are contrary to Islamic culture and faith.

Sheikh Nur Barud Gurhan, deputy chairman of the Supreme Religious Council of Somalia, told local media said such celebrations might motivate Islamic extremist group al-Shabab to launch attacks in the Muslim-majority nation.

"We [Islamic scholars] are warning against the celebration of such events that are not relevant to the principles of our religion. Such events give also al-Shabab to carry out attacks,” Gurhan reportedly said Tuesday.

Christmas and New Year's are not widely celebrated in Somalia. The country’s population of 10 million people is almost entirely Muslim, with the majority belonging to the Sunni sect of Islam.

In 2009, Somalia adopted Shariah law, the legal code of Islam based on the Koran, a measure lawmakers hoped would boost popular support for the government and deter insurgency, the New York Times reported at the time. But the move has not curbed attacks by Islamic extremists in the region.

Most recently, suspected al-Shabab militants ambushed a bus near the Kenya-Somalia border on Sunday, killing at least two people and wounding others. A group of Muslims on the bus shielded Christian passengers from the gunmen by refusing to be separated into groups, eyewitnesses told BBC News .

Many rural areas of Somalia are controlled by al-Shabab, and the group has imposed a strict version of Shariah law there. The al Qaeda affiliate emerged in 2006 from the now-defunct Islamic Courts Union that controlled Mogadishu. Al-Shabab launched its own insurgency on major Somali cities by 2009. The militants have increased efforts in recent months to oust the United Nations-backed government and regain control of territories it lost to Somali and international forces around 2012.