Police in Brussels have shot dead the man who killed two Swedish nationals on Monday evening.
The 45-year-old man named as Abdesalem was shot in a café in the Schaerbeek neighbourhood.
Two Swedes were killed and a third seriously injured in the automatic rifle attack on Monday.
It took place on Boulevard d'Ypres, 5km (3 miles) from the stadium where Belgium was playing Sweden to qualify for the Euro 2024 football tournament.
Brussels has been on its highest terror alert ever since.
The gunman is believed to be a Tunisian man who was in Belgium illegally, after his asylum application was rejected in 2020.
He posted a video online saying he had killed people in the name of God and the prosecutor's office believes he was inspired by the Islamic State group.
Belgian Interior Minister Annelies Verlinden said the automatic weapon found on him was the same as the one used in Monday's attack.
Prime Minister Alexander De Croo called Monday's shooting "a harrowing act of terrorism" in a press conference, and prosecutors said the victims were probably targeted because they were Swedish.
Sweden's foreign ministry sent a text message to its citizens in Belgium on Tuesday morning telling them to be vigilant. It later issued a statement urging all Swedes abroad to be careful.
"Everything suggests this is a terror attack targeted at Sweden and Swedish citizens," said the country's Prime Minister Ulf Kristersson.
The attack began at 19:00 on Monday (17:00 GMT), when a man opened fire in the north of Brussels' city centre.
Videos shared online showed a man on a scooter, dressed in an orange fluorescent jacket, pull up and start shooting passers-by.
He then chases people into the hallway of an apartment building to gun them down. Four gunshots can be heard.
The perpetrator shot three people of Swedish nationality, killing two of them.
A witness who spoke to Belgium's LN24 channel described his shock, saying he froze. "I didn't move. It was a man who came, pushed me, told me to stop running if I wanted to stay alive."
Shortly after the attack, the gunman filmed himself admitting to the killings.
In the video, Arabic-speaking Abdesalem refers to fighting for God and says he has killed Swedish people.
An overnight manhunt was launched and the threat level in the capital was raised to four. France also stepped up security measures at the Belgian border.
A search was carried out in Schaerbeek, at the address where the suspect was staying.
On Tuesday morning, a witness informed the police that he had seen the suspect in a café near his accommodation, and that he was carrying a military weapon and a bag of clothes.
He was shot in the chest and sent to hospital, where he received intensive care treatment before dying from his wounds.
Despite the gunman being killed, some people in Brussels and elsewhere in Europe are nervous about the threat of more terrorist attacks.
"I'm scared," Latifa, a local resident, told the BBC. "I don't feel safe. When I saw the police here, I felt relief."
Belgian prosecutors initially said there did not appear to be any links between the attack and the Israel-Gaza war.
They later said they could not exclude that possibility.
Top asylum official Nicole de Moor said the gunman, who applied for asylum in November 2019 but was rejected the following October, had gone off the radar.
In February 2021, he was removed from the national register and a month later he was ordered to leave the country.
Justice Minister Vincent Van Quickenborne said the man was considered a threat to national security, suspected of human trafficking and known to police in connection with people smuggling.
Sweden raised its terror threat alert to the second-highest level in August after a series of Quran burnings, which triggered protests and condemnations by several Muslim-majority countries.