The group Islamic State in Iraq and Syria (ISIS) said on Saturday that its fighters were responsible for a shooting that killed dozens of Egyptian Christians on Friday, according to a statement from the group.
Gunmen ambushed a bus transporting Christians to a monastery south of Cairo on Friday, killing 29 people and wounding 24 others.
Hours after the attack, Egyptian air force planes carried out strikes directed at camps in Libya, which Cairo says have been training militants who killed the Christians earlier in the day, Egyptian military sources said.
Egyptian President Abdel Fattah el-Sissi said he had ordered strikes against what he called terrorist camps, declaring in a televised address that states that sponsored terrorism would be punished.
The sources said six strikes took place near Derna in eastern Libya at around sundown.
The Egyptian military said the operation had been undertaken once it had been ascertained that the camps had produced the gunmen behind the attack on the Coptic Christians in Minya, central Egypt, on Friday morning.
"The terrorist incident that took place today will not pass unnoticed," el-Sissi said. "We are currently targeting the camps where the terrorists are trained."
He said Egypt would not hesitate to carry out further strikes against camps that trained people to carry out operations against Egypt, whether those camps were inside or outside the country.
Egyptian military footage of pilots being briefed and warplanes taking off was shown on state television.
East Libyan forces, close allies of Egypt led by Gen. Khalifa Hifter, said they participated in the airstrikes, which had targeted forces linked to al-Qaeda at a number of sites, and would be followed by a ground operation.
A resident in Derna heard four powerful explosions, and told Reuters that the strikes had targeted camps used by fighters belonging to the Majlis al-Shura militant group.
Majlis al-Shura spokesperson Mohamed al-Mansouri said in a video posted online that the Egyptian airstrikes did not hit any of the group's camps, but instead hit civilian areas.
Gunfire and blood
Eyewitnesses said masked men opened fire after stopping the Christians, who were in a bus and other vehicles on a desert road. Local TV channels showed a bus apparently raked by gunfire and smeared with blood.
Clothes and shoes could be seen lying in and around the bus, while the bodies of some of the victims lay in the sand nearby, covered with black sheets.
Eyewitnesses said three vehicles were attacked. First to be hit was a vehicle taking children to the monastery as part of a church-organized trip, and another vehicle taking families there.
The gunmen boarded the vehicles and shot all the men and took all the women's gold jewelry. They then shot women and children in the legs.
When one of the gunmen's vehicles got a flat tire they stopped a truck carrying Christian workers, shot them, and took the truck.
One of the gunmen recorded the attack on the Copts with a video camera, eyewitnesses said.
The attack took place on a road leading to the monastery of Saint Samuel the Confessor in Minya province, which is home to a sizable Christian minority.
Security forces launched a hunt for the attackers, setting up dozens of checkpoints and patrols on the desert road.
Police armed with assault rifles formed a security perimeter around the attack site while officials from the public prosecutor's office gathered evidence. Heavily armed special forces arrived later, wearing face masks and body armour.
The injured were taken to local hospitals, and some were being transported to Cairo. The Health Ministry said that among those injured were two children aged two.
Trump condemns attack
U.S. President Donald Trump, who has made a point of improving relations with Cairo, said America stood with el-Sissi and the Egyptian people. "The treasured and historic Christian communities of the Middle East must be defended and protected," Trump said.
The grand imam of al-Azhar, Egypt's 1,000-year-old centre of Islamic learning, said the attack was intended to destabilize the country.
"I call on Egyptians to unite in the face of this brutal terrorism," Ahmed al-Tayeb said. The Grand Mufti of Egypt, Shawki Allam, condemned the perpetrators as traitors.
The head of the Coptic Christian church, Pope Tawadros, who spoke with el-Sissi after the attack, said it was "not directed at the Copts, but at Egypt and the heart of the Egyptians".
Pope Francis, who visited Cairo a month ago, described the attack as a "senseless act of hatred".
4 attacks since December
Coptic Christians, whose church dates back nearly 2,000 years, make up about 10 per cent of Egypt's population of 92 million.
They say they have long suffered from persecution, but in recent months the frequency of deadly attacks against them has increased. About 70 have been killed since December in bombings claimed by ISIS at churches in the cities of Cairo, Alexandria and Tanta.
An ISIS campaign of killings in North Sinai prompted hundreds of Christians to flee in February and March.
Copts fear they will face the same fate as brethren in Iraq and Syria, where Christian communities have been decimated by wars and ISIS persecution.
Egypt's Copts are vocal supporters of el-Sissi, who has vowed to crush Islamist extremism and protect Christians. He declared a three-month state of emergency in the aftermath of the church bombings in April.
But many Christians feel the state either does not take their plight seriously enough or cannot protect them against determined fanatics.
The government is fighting insurgents affiliated with ISIS who have killed hundreds of police and soldiers in the Sinai Peninsula, while also carrying out attacks elsewhere in the country.