The attack on the tourists took place just hours after five policemen were killed in a shooting near some of Egypt's most famous pyramids

Receive the latest national-international updates in your inbox

In this picture taken Thursday, Aug. 20, 2015, tourists walk on the Giftun Island beach as the sun sets over the Red Sea in Hurghada, Egypt.

The Egyptian university graduate who stabbed two German women to death at a popular Red Sea resort first sat and spoke to them in fluent German before producing a large kitchen knife and attacking them, security officials said Saturday.

Leaving them for dead, 29-year-old Abdel-Rahman Shaaban fled the scene, chased by hotel workers and security guards. He rushed into the hotel next door where he attacked and wounded four female tourists who, according to local media reports, included two Armenians, one from Ukraine and another from the Czech Republic.

"Stay back, I am not after Egyptians," Shaaban shouted in Arabic at his pursuers, according to the officials. They eventually caught up with him, disarmed and pinned him down and later handed him over to the police. Shaaban stabbed the women in the face, neck and feet, said the officials.

No group claimed responsibility for the Friday attack, but it appeared to have been inspired by recent calls made by the local affiliate of the extremist Islamic State group on its followers to attack Egypt's minority Christians and foreign tourists.

The officials said Abdel-Rahman hails from the Nile Delta province of Kafr el-Sheikh where he attended the business school of the local branch of Al-Azhar University — the world's foremost seat of learning of Sunni Islam and the target of mounting criticism in recent months over its alleged radical teachings and doctrinal rigidity.

Investigators were still trying to determine how Shaaban came to be in Hurghada, one of Egypt's main Red Sea resorts, popular for its year-round sunny weather and diving.

The officials spoke on condition of anonymity because they were not authorized to speak to the media.

A statement by the national security prosecution's office, which is questioning Shaaban in Cairo, said Saturday that his motives and ideological convictions remained unclear. "The characterization of the action committed by the culprit, whether it is an individual act, criminal or terrorist, is not clear to the prosecution at this time," said the statement.

Police are meanwhile interviewing 15 hotel workers to piece together what happened.

Germany on Saturday gave the first official confirmation that the two tourists killed by Shaaban were German nationals, but gave no other information. Local German media reports, however, said the two were residing in Hurghada, not tourists.

In a statement, the German Foreign Ministry said: "According to everything that we know, this act was aimed at foreign tourists — a particularly perfidious and criminal act that leaves us sad, dismayed and angry."

The attack on the tourists took place just hours after five policemen were killed in a shooting near some of Egypt's most famous pyramids in the greater Cairo area. No group claimed responsibility for that attack, which bore the hallmarks of a militant group known as Hasm that has been behind similar attacks in recent months.

Authorities say Hasm is a splinter faction of the Muslim Brotherhood, an Islamist group that was outlawed and declared a terrorist organization several months after the military in July 2013 ousted Mohammed Morsi, a senior leader of the Brotherhood who was elected president in 2012.

Friday's attacks are likely to further impact Egypt's tourism industry — a backbone of the country's economy that employs millions of people but which has been decimated by the political turmoil and lacking security roiling the country since the 2011 Arab Spring uprising.

On Saturday, tight security was in place at Hurghada, with additional checkpoints at the city's entry and exit points and reinforced security at tourist sites, including where the attack took place.

Egypt has been rocked by deadly suicide bombings, drive-by shootings and other attacks since Morsi's ouster four years ago. The violence has been concentrated in the northern Sinai Peninsula, but attacks have spread to the mainland, including the capital.

The last time tourists were attacked in Hurghada was in January 2016, when two Austrians and a Swede were stabbed by two suspected militants, also at a hotel. They were only lightly wounded. Security forces shot the attackers, killing one and wounding the other before arresting him.

Separately, authorities on Saturday said four suspected militants were killed in an exchange of gunfire with the police in the desert near the Suez Canal city of Ismailia east of Cairo. The shootout was not related to Friday's attacks at Hurghada and Cairo.

Also Saturday, army troops backed by armored vehicles and snipers deployed outside churches and monasteries in southern province, a precaution against possible attacks by Islamic militants. The deployment came ahead of two major festivals by the sizable Orthodox Coptic church in southern Egypt in the next few weeks that routinely attract millions of worshippers.

Churches in Egypt have also suspended for the remainder of the summer organized pilgrimages and holiday trips for their congregations, following the recommendations of security agencies fearing for their safety.

IS militants have vowed to attack Egypt's minority Christians, as punishment for supporting President Abdel-Fattah el-Sissi who, as defense minister, led the military's 2013 ouster of the Islamist Mohammed Morsi, a freely elected president whose one year in office proved divisive. They have targeted several churches in a series of suicide attacks since December. In May, they shot dead about 30 pilgrims traveling to a remote desert monastery. In all, at least a 100, mostly Christian, people were killed in those attacks.