CNN  — 

Belgian authorities are investigating the killing of two policewomen and a passerby in the eastern city of Liege on Tuesday as a terror attack, the country’s prosecutor said.

Belgian media, including CNN affiliate RTBF, are naming the gunman as Benjamin Herman. A spokesperson for the Brussels prosecutor told CNN the attacker, who was shot dead by police, was 31 years old and had the initials B.H. but declined to provide the full name.

RTBF reported that Herman was let out of prison on temporary release on Monday. He had been serving time on drug offenses. It said he may have been radicalized while in jail.

The incident occurred around 10:30 a.m., when the assailant stabbed two policewomen from behind before stealing their service weapons and using them on the officers, Liege Prosecutor Philippe Dulieu said at a news conference on Tuesday.

After killing the two officers, the attacker continued walking through the street and opened fire on a parked vehicle, fatally wounding the driver inside, Dulieu said.

According to the prosecutor, the suspect then took refuge in a local high school, where he held a woman hostage. When police intervened, the man opened fire, injuring several other officers, before he was shot dead.

“It is clear that the objective of the assassin was to target the police,” the head of Liege Police, Christian Beaupere, said later Tuesday. Beaupere said he wanted to reassure parents that the gunman did not plan to attack a school. “His objective was not to kill in a school but to harm the police, the institutions and the state of Belgium.”

He refused to comment further on the investigation, saying the case is now with the Belgian prosecutor’s office.

It is not yet clear precisely what the attacker’s motive may have been, a spokesperson from the Liege prosecutor’s office told CNN earlier.

Belgian Prime Minister Charles Michel said he and the government send their thoughts to the victims and their families.

The Belgian Royal Palace also tweeted its sympathies after the shooting. “Our thoughts are with the victims of this horrible act. Courage to their loved ones,” the tweet read.

Michel and King Philippe of Belgium arrived in Liege later Tuesday.

Belgian Interior Minister Jan Jambon said on Twitter that the country’s crisis center had been monitoring the situation. The crisis center said the students in the school were safe and that none had been injured.

A police officer speaks with parents of children at a nearby high school.

Liege resident Didier Deflem filmed a video allegedly showing special intervention police units shooting at the Liege attacker in front of the Waha high school.

Deflem said: “Police made us enter the building to protect us. The PAB (Peloton anti-banditisme, a special intervention unit of the city of Liege) intervened. The man wanted to run out and he was shot down. That’s all I saw. We’re still in shock.”

Pierre Etienne Dit Pave, who teaches French language classes nearby,said he was first alerted to the attack by a “commotion in the street” and went out to investigate.

“At one point a policeman told me to go inside. I went back to the classroom and locked the door for a while,” he said. “We heard a lot of shots. We didn’t see anything because we were locked in the room. We were waiting for police to give us the clearing.”

In this grab made from a video obtained on the Twitter account of Victor Jay (@victorj_fr), police and emergency vehicles block a nearby crossroads.

Liege is Belgium’s third-largest city, after Brussels and Antwerp, according to the national tourist office. For centuries, it has been an important cultural and industrial center for the country.

In 2011, Liege was the scene of a grenade and gun attack that left at least five dead and injured more than 100.

This story has been updated to correct the gender of the police officers who were killed.

CNN’s Judith Vonberg, Sebastian Shukla and Lindsay Isaac contributed to this report.