By Francois Lenoir and Christopher Stern
LIEGE, Belgium (Reuters) - A man killed two policewomen and a bystander in the Belgian city of Liege on Tuesday before being gunned down at a school in what officials said was a terrorist attack by a radicalized "lone wolf" just out of prison.
The man was named by Belgian media as Benjamin Herman, a 36-year-old drug dealer and thief who was let out on a two-day pass on Monday. Police suspect him also of the murder of a former associate found dead at his home early on Tuesday.
A Belgian lawmaker said he figured on a watchlist of people suspected of being in contact with Islamist radicals in jail - raising questions about why he was freed unsupervised.
Officials said the man attacked the policewomen, aged 45 and 53, from behind with a knife - described as a box-cutter by local media - around 10:30 a.m. (0830 GMT) on a boulevard in the centre of Belgium's third city, near the German border.
After slashing the officers, the man seized their handguns and shot both. He shot dead a 22-year-old trainee teacher who was sitting in a car before entering a high school about 100 metres (yards) away and taking two female employees hostage.
That triggered a major intervention by armed police. Pupils were moved to safety as a gunbattle broke out that sent people in the street racing for cover. Four officers were wounded before the attacker was finally killed on the sidewalk.
"The goal of the assassin was to target the police," Liege police chief Christian Beaupere told a news conference.
The attacker's profile revealed concerns about the risks of petty criminals, including those not from Muslim backgrounds, being inspired to Islamist violence while incarcerated. Convicts have been behind several recent attacks in Europe, including some using little more weaponry than a knife or rental truck.
The national crisis centre, on high alert since attacks by Islamic State in Paris and Brussels over the past three years, said it had not raised its alert level - an indication the man was acting alone and so follow-up attacks were not expected.
A police source told Reuters that Herman shouted "Allahu Akbar" -- God is greatest in Arabic -- during the incident.
A Koran and prayer rug were found during a search of his cell, local media said. The justice minister said Herman had been freed for two days to prepare for his eventual release in 2020. He had caused no problem on previous furloughs.
Confirming that the attacker was on a police watchlist, lawmaker George Dallemagne, who sits on several Belgian parliamentary security committees, tweeted: "The supervision of radicalised prisoners remains tragically flawed."
Prime Minister Charles Michel said, however, that Herman had not figured directly on the main national register of threats.
Images posted on social media showed elements of the drama:
What appeared to be the bodies of the two police officers, arms bare on a hot sunny morning, wearing protective vests and lying in pools of blood a couple of metres apart outside a cafe; the gunman, dressed in black, waving a pistol in each hand, standing in the middle of the road; and finally the assailant emerging from the school onto the street, firing on police, who gun him down - continuing firing after he first went down.
Prime Minister Michel and King Philippe visited Liege, the biggest city in Belgium's French-speaking Wallonia region. An industrial hub on the Meuse river, it was the scene of a mass shooting in 2011, when a man killed four people and wounded over 100 others before turning his gun on himself.
A Brussels-based Islamic State cell was involved in attacks on Paris in 2015 that killed 130 people and on Brussels in 2016 in which 32 died.
(Additional reporting by Robert-Jan Bartunek, Alissa de Carbonnel and Philip Blenkinsop in Brussels; writing by Alastair Macdonald; editing by Andrew Roche/Mark Heinrich)