Egypt on Saturday said an attack on a mosque by militants in the country's troubled region of northern Sinai has killed 305 worshippers, including 27 children, a dramatic increase in the death toll previously announced, which was 235.

A statement by the country's chief prosecutor, Nabil Sadeq, said the attack Friday left another 128 people wounded.

It said the attackers, estimated at between 25 and 30, arrived at the mosque close to the small town of Bir al-Abd in five all-terrain vehicles and positioned themselves at the main door and the facility's 12 windows before opening fire. They also torched seven cars parked outside the mosque, which belonged to worshippers inside.

Quoting testimonies given to investigators by survivors, the statement said some of the attackers were masked. Those who were not sported heavy beards and long hair. The militants wore camouflaged pants and black T-shirts, it added.

Also on Saturday, Egyptian warplanes were in action over Sinai, according to the military, targeting several vehicles in which some of the culprits of the attack were traveling. All passengers of the vehicles were killed, it added. It was impossible to independently verify the claim since the media is virtually banned from working in Sinai.

The chief prosecutor's statement was the most detailed by authorities on the attack, the deadliest by Islamic extremists in Egypt's modern history. The account it gave generally agreed with what witnesses told The Associated Press on Saturday in the Suez Canal city of Ismailia, where some of the wounded are hospitalized.

They spoke of horrific scenes during the approximately 20 minutes it took the militants to kill and maim worshippers. They spoke of some jumping out of windows, a stampede in a corridor leading to the washrooms and of children screaming in horror. Some spoke of their narrow escape from a certain death, others of families that lost all or most of their male members.

One witness, Ebid Salem Mansour, said the imam had barely made it atop the mosque pulpit to deliver the sermon when intense gunfire rang out. "We knew that the mosque was under attack by (militants)," he said, recounting an attack that constitutes a grim milestone in Egypt's brutal fight against increasingly emboldened militants.

Mansour, a 38-year-old worker in a nearby salt factory, said he settled in Bir al-Abd, the small town near where the attack took place, three years ago to escape the bloodshed and fighting elsewhere in northern Sinai. He suffered two gunshot wounds in the legs on Friday.

"Everyone layed down on the floor and kept their heads down. If you raised your head you get shot," he said. "The shooting was random and hysterical at the beginning and then became more deliberate: Whoever they weren't sure was dead or still breathing was shot dead."

The militants were shouting Allahu Akbar, or God is great, and the children were screaming, Mansour said.

"I knew I was injured but I was in a situation that was much scarier than being wounded. I was only seconds away from a certain death," he said. As the shooting took place, many of the worshippers recited their final prayers, he added.

Friday's attack targeted a mosque frequented by Sufis, members of a mystic movement within Islam. Islamic militants, including the local affiliate of the Islamic State group, consider Sufis heretics because of their less literal interpretations of the faith.

President Abdel-Fattah el-Sissi vowed that the attack "will not go unpunished" and that Egypt would persevere with its war on terrorism. But he did not specify what new steps might be taken. On Saturday, he ordered that a mausoleum be built in memory of the victims of Friday's attack.

The military and security forces have already been waging a tough campaign against militants in the towns, villages and desert mountains of Sinai, and Egypt has been in a state of emergency since April. Across the country, thousands have been arrested in a crackdown on suspected Islamists as well as against other dissenters and critics, raising concern about human rights violations.

Seeking to spread the violence, militants over the past year have carried out deadly bombings on churches in the capital of Cairo and other cities, killing dozens of Christians. The IS affiliate is also believed to be behind the 2016 downing of a Russian passenger jet that killed 226 people over Sinai.

Friday's assault was the first major militant attack on a Muslim congregation, and it eclipsed past attacks, even dating back to a previous Islamic militant insurgency in the 1990s.

The militants, according to another witness, said worshippers began to jump out of windows as soon as the militants opened fire. "The small door that leads to the corridor for the wash rooms was about the only one where worshippers rushed to escape," said a 38-year-old government employee who did not want to be named for fear of retaliation.

"There was a stampede. I fell down and then bodies piled up on top of me," he said

No one claimed responsibility for the attack. But the IS group affiliate has targeted Sufis in the past.

Last year, the militants beheaded a leading local Sufi religious figure, the blind sheikh Suleiman Abu Heraz, and posted photos of the killing online. Islamic State group propaganda often denounces Sufis. In the January edition of an IS online magazine, a figure purporting to be a high level official in the Sinai affiliate of the group vowed to target Sufis, accusing them of idolatry and heretical "innovation" in religion and warning that the group will "not permit (their) presence" in Sinai or Egypt.

Millions of Egyptians belong to Sufi orders, which hold sessions of chanting and poetry meant to draw the faithful closer to God. Sufis also hold shrines containing the tombs of holy men in particular reverence.

Islamic militants stepped up their campaign of violence in northern Sinai after the military ousted the elected but divisive Islamist Mohammed Morsi from power in 2013 and launched a fierce crackdown on his Muslim Brotherhood group.

The result has been a long, grinding conflict centered on el-Arish and nearby villages and towns. The militants have been unable to control territory, but the military and security forces have also been unable to bring security, as the extremists continuously carry out surprise attacks, mostly targeting outposts and convoys.

The attacks have largely focused on military and police, killing hundreds, although exact numbers are unclear. The militants have also assassinated individuals the group considers to be spies for the government or religious heretics. Egypt has also faced attacks by militants in its Western Desert.