Egypt's Coptic Orthodox Christians flocked to churches on Wednesday to attend Masses on Christmas Eve across the predominantly Muslim country, as the government continues to battle a burgeoning Islamic insurgency.

Police painstakingly searched more than 300 churches in the capital, Cairo, alone for explosive devices, according to police Maj. Gen. Gamal Halawa. Roadblocks were set up before churches nationwide and cars and motorcycles were temporarily banned from idling in front of them, he added.

Police targeted "any attempt to spoil the joy of the celebrations with decisive and firm action," Halawa said.

Militant attacks have multiplied after the military overthrew Islamist President Mohammed Morsi in 2013, spreading from the restive Sinai Peninsula and striking the mainland numerous times in recent months. Some extremists in Sinai have pledged allegiance to the Islamic State group and claimed the downing of a Russian airliner that killed 224 people there last year.

Egypt's Orthodox Coptic Christians strongly supported the ouster of the first freely elected, but divisive leader. Ever since, Christian gatherings have been at a greater risk of attacks. Following Morsi's toppling, many Islamists claimed Christians had conspired with the military against them as attacks on Christian homes, businesses and churches surged south of Cairo.

"We have been late in restoring and fixing what has been burned. Everything will be fixed. ... Please accept our apologies for what happened," President Abdel-Fattah el-Sissi, who as military chief led Morsi's ouster, told the Christian crowds at Cairo's St. Mark Cathedral in a rare public apology and acknowledgement of the attacks.

El-Sissi, widely seen as a savior by Christians, received a rock star greeting at the cathedral, the sea of the Coptic Orthodox Church. Security forces apparently failed to contain the cheering, flowers-throwing crowds on el-Sissi's way out of the church, forcing them to turn back and leave from a different exit.

Outside St. Mark, heavily armed black-clad troops flanked the massive cathedral, as journalists and guests passed through metal detectors and had their IDs checked numerous times before they were granted entry. Metal detectors were also set up in most churches nationwide.

Wednesday's tightened security measures were in part a preparation for the Jan. 25 anniversary of the 2011 uprising that toppled longtime autocrat Hosni Mubarak. Officials including el-Sissi have voiced concern about attempts to mark the anniversary of the revolt with protests in recent weeks.

Throughout history, Egyptian presidents never attended Christmas masses, making el-Sissi's visit this year, the second of its kind, doubly appreciated. The grinning president was joined by Muslim cabinet members, prominent pro-state media personalities and public figures.

"He loves us and we love him," said homemaker Nahed Maged of Cairo, who watched the televised Mass from home. "Previous presidents used to ignore us, but he comes to church, shows us respect and smiles."

Egypt's Orthodox Coptic Christians make up about 10 percent of the country's 90 million people. The Copts have long complained of discrimination, which many say still exists even under el-Sissi.

"Nothing has really changed in terms of our rights and freedoms," said Michelle Labib, a Christian 45-year-old computer programmer in Cairo. "It is annoying how they make him out to be a hero when our lives have not improved in any way."

Labib and others say the Christian gratitude for el-Sissi's ouster of the Islamist Morsi amid mass protests against his rule has begun to wane. The Christians widely mobilized against the ousted and currently jailed Morsi in the hope they would win equal standing with Muslims after his removal.