BRUSSELS — A potentially deadly terrorist bombing at a central Brussels train station was averted after a nail-packed device in a bag failed to fully detonate, a Belgian prosecutor said Wednesday, a day after the attack at the crowded rail hub.

A 36-year-old Moroccan national who lived in Brussels attempted the attack, which started at 8:39 p.m. Tuesday, prosecutor Eric Van der Sypt said. The man, identified only by his initials, O.Z., was known to police but had no previously discovered terrorist ties, the prosecutor said.

He was shot dead after he shouted “Allahu akbar” – Arabic for “God is great” – and tried to attack a soldier in the station, Van der Sypt said.

Authorities said the attack in a crowded Brussels station could have been far worse if the explosives had fully detonated. The suspect first attempted to detonate his bag, setting off a “partial explosion” as he ran toward a group of people in the mezzanine level of the station that descends to the tracks, Van der Sypt said.

The bag caught fire, and the suspect dropped it and ran toward the tracks. Then the bag exploded “more violently,” Van der Sypt said, but it still failed to fully ignite the canisters of gas that were contained within. Nails were also packed into the bag, he said. The suspect was not wearing an explosives-laden belt, Van der Sypt said, contrary to an initial eyewitness account from a railway official.

No one was hurt during the attack apart from the suspect. He lived in the Brussels area of Molenbeek, which was also home to several of the men involved in the March 2016 double attack in Brussels that claimed 32 victims at the Brussels airport and a subway station. Searches continued Wednesday in Molenbeek.

The foiled attack came on a continent that has been hit repeatedly by terror in recent weeks. Just Monday, there was a failed car attack on the Champs-Elysees in Paris. Earlier this month there was an attack in London.

But Belgian authorities left their national terrorism threat level unchanged, indicating they do not believe another attack is imminent.

The Belgian government is determined to “face a terrorist situation in Europe and not only in Belgium head on, and not to let ourselves be intimidated,” Belgian Prime Minister Charles Michel told reporters after convening his security advisers. Public transportation was reopened Wednesday morning, he said. And a concert by Coldplay that is expected to draw large crowds Wednesday evening will be supplemented with extra security.

But in a possible measure of security concerns, police closed several streets midday Wednesday around Antwerp’s central train station, and a large-scale search appeared to be underway, Belgian media reported. There was no immediate indication whether the search was terror-related.

Elsewhere in Europe, there was ongoing concern about Islamic State threats. Spain’s Interior Ministry said Wednesday that authorities detained a suspected member of the Islamic State and two other Moroccan citizens. The suspect possessed manuals about suicide attacks and is believed to have been in contact with members of the Islamic State in Syria and Iraq, the ministry said in a statement.