At least 27 people have been killed in an explosion inside a church in the Egyptian Nile Delta city of Tanta, state media reported, as another blast killed 16 in front of a church in the coastal city of Alexandria.

The Islamic State of Iraq and the Levant (ISIL, also known as ISIS) armed group on Sunday claimed responsibility for both attacks, in a statement via its Amaq website. It said they were carried out by two of its fighters wearing suicide vests.

Following the blasts, Egyptian President Abdel Fattah el-Sisi ordered troops be deployed across the country to help secure "vital facilities" and said a three-month state of emergency would be imposed.

The first attack occurred in the Coptic church of Mar Girgis, also known as St George, which was packed with worshippers marking Palm Sunday, a Christian feast commemorating the entry of Jesus Christ into Jerusalem.

Egypt's state television reported that at least 71 people were wounded in the attack.

OPINION: Sinai insurgency - An enduring risk

Several hours after the bombing in Tanta, another explosion hit in front of Saint Mark's church in Alexandria, where Coptic Pope Tawadros II was leading a service.

Egypt's state media said at least 16 people, including seven police officers, were killed in the suicide bomb attack.

Some on social media praised at least two police officers who they say stopped the bomber from entering the church. They were killed in the blast.

Witnesses in Tanta described a bloody and chaotic scene.

"Lots of bodies were torn apart and scattered on the floor," said one man who was standing on the church's altar when the bomb exploded.

READ MORE: Egypt's Coptic Christians flee Sinai after killings

Another witness said she saw flames flaring up to the church ceiling.

"There was thick smoke, I couldn't see anyone," she said. "We heard voices telling us to leave quickly. People were pushing so much that the gate bent."

Samer Shehata, associate professor at the Doha Institute for Graduate Studies, told Al Jazeera the attacks show a "tremendous security lapse" by Egyptian authorities.

"In the last few months, there has been an increased number of attacks on Egyptian Copts, individually, as well as on churches," Shehata said, adding that the church in Tanta received a threat 10 days ago.

"I do think this represents a lack of seriousness on the part of the state in really securing the Coptic community and places that could potentially be attacked."

Timothy Kaldas, non-resident fellow at the Tahrir Institute for Middle East Policy, said the attacks were designed to create religious strife.

"It is alarming to see a specific religious group being targeted, which is going to rattle the Coptic community and many Egyptians in general," Kaldas told Al Jazeera.

Copts repeatedly targeted

The bombings were the latest in a series of assaults on Egypt's Christian minority, who make up about 10 percent of the population and have been repeatedly targeted by armed groups.

They also come just weeks before Pope Francis is due to visit Egypt.

CBC TV showed footage from inside the church in Tanta, with a large number of people gathered around what appeared to be lifeless, bloody bodies covered with papers.

A bombing at Cairo's largest Coptic cathedral killed at least 25 people and wounded 49 in December, many of them women and children, in the deadliest attack on Egypt's Christian minority in years.