The Belgian prisoner who killed four people during a two-day furlough spared the life of the high school janitor he took hostage because she is Muslim, according to the woman, who was hailed Wednesday for her courage as she faced off with the madman.

Minister of the Interior Jan Jambon said the woman, who is originally from Morocco and identified only as Darifa, was “very courageous” during her terrifying encounter with cop-killer Benjamin Herman — and likely prevented further bloodshed.

“Perhaps her actions avoided there being more victims of the incident at the school,” he told local broadcaster RTL.

Jambon, Prime Minister Charles Michel and King Philippe visited the woman in the hospital, where she was being treated for shock after being held inside Léonie De Waha school by Herman, 36 — who ran into the building moments after stabbing and shooting two policewomen and killing a bystander.

Herman shouted “Allahu Akbar!” — “God is great” in Arabic — during the attack, is suspected of having been radicalized in prison and was on a two-day furlough from prison when he went on his rampage.

The woman spoke to TV station RTBF by phone from the hospital.

The first thing the shooter asked her was “Are you Muslim?” and “Are you doing Ramadan?,” she told the station.

When she answered “Yes” to both questions, Herman told her not to worry, to do what he said and that he wouldn’t harm her, she said.

“I told him he was not in the right place,” she recalled. “’You’re in a school here,’” she told him. “’There are lots of kids.’”

When he pulled her to a window so that police could see her, she started screaming and crying.

“He told me to stop, to think about my Palestinian brother and my Syrian brothers, that it was for them that I had to cry,” she recalled.

The killer didn’t seem nervous or like he wanted to try to escape, as cops surrounded the school, she said. Instead, he told her he was there to make people nervous and the cops angry.

“At one moment he told me to open the door and tell the cops to leave. Then we opened the door a second time so he could throw his ID so they could see who he was. And the third time, he went outside, and that’s it. I think he knew it was over for him. And he went outside.”

Herman ran out into the street with his gun blazing, injuring four officers, before being shot dead by cops.

None of the 1,100 students in the school were harmed.

“Everyone was able to evacuate because of this hostage situation,” the school’s principal, Rudy Greeten, told RTBF. “This woman, one of our custodians, was taken hostage and spoke with this fanatic, who claimed Islam, well, she is Muslim and I think that was able, at some point, to appease him.”