A deadly attack outside of a Coptic Christian church in Cairo left 9 people dead on Friday, but a brave Egyptian man reportedly jumped into high gear and took action to prevent the casualty number from dramatically rising.

In fact, 53-year-old Salah el-Mougi is being credited with jumping on the gunman while the madman was reloading his automatic rifle and, as a result, saving dozens of lives, as The Associated Press reported.

But that heroic man wasn’t alone in his selflessness, as the AP noted that Muslims and Christians, alike, teamed up to try and stop the suspected gunman, who was later identified as 33-year-old Ibrahim Ismail Ismail Moustafa.

Other witnesses immediately pounced once el-Mougi took Moustafa down.

“We all hit him, and I was about to smash his head with a rock,” witness Mustafa Mahmoud said. “But the police wanted him alive and they fired in the air to disperse us.”

At first, police were credited with quick-thinking actions that halted the bloodshed, but witnesses later said that the assault went on for 20 minutes and it wasn’t until about a half-hour after it began that cops arrived on the scene.

Christians worshipping at the church even closed the gate on the madman, which also saved lives. And others, including Muslims, reportedly threw rocks Moustafa, who ended up fleeing the church.

“The terrorist was very agitated when they closed the church’s iron gate and he could not go inside,” local store owner Magdy Adel told the AP. “He had a lot of ammunition and kept shooting at the gate, killing some people inside.”

Others described the gunman as either “suicidal or deranged.” Sadly, a policeman was among those killed, but the situation was at least halted before even more parishioners were murdered.

The BBC reported that ISIS took responsibility for the attack. The outlet also noted that more than 100 Christians were slaughtered in Egypt in 2017. Egypt was ranked by Open Doors USA as the 21st worst place in the world to live as a Christian.