BRUSSELS — A prison inmate on a 48-hour leave fatally shot two police officers and a civilian and then took a woman hostage at a school in the eastern city of Liège on Tuesday, before being killed by the police, officials said. No students were injured.

“The goal of the attacker was to target the police,” Liège’s police chief, Christian Beaupère, said. The assailant, a Belgian, had a long criminal record, and prosecutors said they were investigating the attack as a terrorism episode.

Prosecutors said the assailant attacked two female police officers from behind with a knife around 10:30 a.m., stabbed them several times in the back, took their weapons, and used them to shoot and kill the officers.

The attacker also shot and killed a young man sitting in a parked car in central Liège, before running away. He then took a female cleaner hostage in the nearby Atheneum Léonie de Waha school, a public institution with several hundred students ages 3 to 18.