"The Egyptian Air Force pursued the terrorist elements, discovered and destroyed a number of vehicles that carried out the brutal terrorist killings, and killed all terrorists inside those vehicles," military spokesman Tamer Rifai said in a statement Saturday.

It also targeted a number of terrorist outposts containing weapons, ammunition and radical elements, Rifai said.

President Abdel Fattah el-Sisi had vowed to respond to the massacre with "brute force."

Al Rawadah mosque is known as the birthplace of an important Sufi cleric. Sufism is a mystical branch of Islam that some ultra-orthodox Muslims consider heretical.

No one has claimed responsibility, but the strike bears the hallmarks of an attack by ISIS.

The attack started when an explosive went off in a building adjacent to the mosque, and gunmen fired at worshipers as they fled, witnesses told CNN. They said gunmen then entered the mosque and fired at those inside.

The attackers had also set up "ambush" locations and opened fire on ambulances as they transported the wounded to al-Arish before the arrival of security services, according to witnesses.

Photos from inside the mosque showed what appeared to be bodies lined up in rows on the carpet.

One man told CNN he drove one of the first ambulances to the scene but turned around after shots were fired at the vehicle. Ambulances from al-Arish managed to reach the mosque only after security forces secured the road, he said.

The attackers used automatic weapons, said Diaa Rashwan, the chairman of the state information service. Some victims were also killed by the explosions.

In a short, televised speech after meeting with security officials, Sisi said the government will hunt down the attackers.

"We will respond to this act with brute force against these terrorists," he said.

"This terrorist act will strengthen our resolve, steadfastness and will to stand up to, resist and battle against terrorism."

The presidency has declared three days of national mourning.

Sisi has expressed concern recently that ISIS militants fleeing Iraq and Syria will come to Egypt.

Egyptian security forces face almost daily attacks from ISIS-aligned militants, whom they have battled in northern Sinai for years. However, mosque attacks are relatively rare in Egypt.