BRUSSELS — The prison inmate on 48-hour leave who fatally shot three people and took a woman hostage at a school in Belgium may have been radicalized while in prison, and he shouted “God is great!” in Arabic during the violent rampage, officials said on Wednesday.

One day after the assault in the eastern Belgian city of Liège, which further unnerved a country that was already on edge after two deadly attacks in Brussels in 2016, officials confirmed that they were investigating the case as possible terrorism, but cautioned that other factors were in play. The extremist group Islamic State claimed responsibility for the attack on Wednesday.

The assailant, identified as Benjamin Herman, a 35-year-old Belgian who was shot and killed by the police as they rescued the hostage, is also suspected of killing a former criminal partner on Monday night, hours after the start of his temporary leave.

“There are signs that allow us to speak of radicalization in prison,” Interior Minister Jan Jambon said about the assailant’s possible motives. “But it can also be because he had no prospects anymore in our society, as he also committed a murder the night before.”