Egyptian air force planes on Friday carried out six strikes directed at camps near Derna in Libya, where armed men responsible for a deadly attack on Christians are believed to have trained, according to military sources.

The Islamic State of Iraq and the Levant (ISIL, also known as ISIS) group on Saturday claimed responsibility for the attack, saying in an online statement that it had been carried out by one of its affiliates.

Egyptian President Abdel Fattah el-Sisi announced on Friday that he had directed strikes against what he called "terrorist camps", declaring in a televised address that states that sponsored terrorism would be punished.

"Egypt will never hesitate to strike terror camps anywhere ... if it plans attacking Egypt whether inside or outside the country," Sisi said.

The Egyptian government said at least 29 Coptic Christians were killed and dozens more wounded by armed men who attacked them while they were travelling to a monastery in Egypt's Minya province.

ISIL put the number at 32.

The Christians were headed to the Saint Samuel Monastery, located outside Minya city, about 220km south of the capital Cairo, when the masked attackers, who came in three pickup trucks, opened fire of them before fleeing the scene.

Egyptian security and medical officials told the Associated Press news agency that many of the dead were children.

Al Jazeera's Mahmoud Abdelwahed, reporting from the Libyan capital Tripoli, said residents of Derna "are very angry" about the air strikes.

"Sources on the ground say the six locations targeted by Egyptian warplanes are civilian areas and populated districts inside the city," he said. "They say that only civilian properties like houses, farms and vehicles have been damaged."

In the last two years, Egyptian air force has carried out several strikes on Derna, notably in February 2015 and March 2016, which killed women and children.

Speaking to Al Jazeera from Boston, Tarek Masoud of Harvard University said Egypt cannot solve its security problem by striking Libya.

"Are the people who perpetrated the latest attack in Egypt based in Libya?" he said.

"I don't know. But the fact that this happened so deep within Egypt suggests to me that the bases of operations of these kinds of attacks are not over the border in Libya, but are actually within Egypt.

"That of course means this is a much bigger problem, one that may not be solved by striking some terrorist bases in faraway Libya."

Egypt's Christian minority, which makes up about 10 percent of the country's population, has repeatedly been targeted by armed groups.

In April, at least 45 people were killed and more than 100 wounded in two separate suicide bomb attacks on churches in the cities of Tanta and Alexandria during Palm Sunday ceremonies.

The attacks were claimed by the Islamic State of Iraq and the Levant (ISIL) group.

Following the Palm Sunday bombings, Sisi declared a nationwide three-month state of emergency.

A bombing at Cairo's largest Coptic cathedral killed at least 25 people and wounded 49 in December 2016, including many women and children.