Egyptian air force planes on Friday carried out strikes directed at camps in Libya, which Cairo says have been training militants who killed dozens of 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, hours after masked gunmen attacked a group of Coptic Christians travelling to a monastery in central Egypt, killing at least 29 and wounding 24.

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 President Abdel Fattah el-Sissi gives an address after the gunmen attacked in Minya. (The Egyptian Presidency/Reuters)

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.

No immediate claim of responsibility

There was no immediate claim of responsibility for the attack on the Christians, which followed a series of church bombings claimed by ISIS in a campaign of violence against the Copts.

ISIS supporters reposted videos from earlier this year urging violence against the Copts in Egypt.

Mourners carry crosses and march after the funeral of Coptic Christians who were killed on Friday in Minya, Egypt. (Mohamed Abd El Ghany/Reuters)

At a nearby village, thousands later attended a funeral service that turned into an angry protest against the authorities' failure to protect Christians.

"We will avenge them or die like them," mourners said, while marching with a giant wooden cross.

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.

Security officials and emergency services attend the site of an armed attack on a bus near the Monastery of St. Samuel the Confessor. (EPA)

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.

U.S. President Donald Trump, who has made a point of improving relations with Cairo, said America stood with President Abdel Fattah el-Sissi (left) and the Egyptian people.

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.

A nun cries as she stands at the scene inside Cairo's Coptic cathedral, following a bombing, on Dec. 11. (Amr Abdallah Dalsh/Reuters)

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.