A suspected terrorist on day release from prison executed two female police officers with their own guns and shot dead a trainee teacher before he was killed in a shootout after taking two women hostage at a school in the centre of the Belgian city of Liege.

The bloody rampage on Tuesday morning, which left another four officers wounded, was captured on videos on social media, which showed the black clad man waving a pistol in each hand and shouting “Allahu Akbar” before he was gunned down by elite officers. Belgium's federal prosecutors office has opened an terror investigation into the attack.

The “lone wolf” attacker, 36, was named locally as Benjamin Herman, who was well-known to police for a string of crimes including robbery, assault and drug-dealing and was from Rochefort, a city about an hour from Liege.

One officer was named in local media reports as Soraya Belkacemi, 45, a widowed mother of twins, who are now orphaned. The other was Lucile Garcia, 53, who was described by fellow officers as a "fantastic colleague" who had married her partner a month ago.

Herman was granted temporary release from prison on Monday night until Tuesday, despite a prison service assessment that judged him “ultra-violent” and that he was on a terror watchlist over suspicions he had become radicalised in 2017.