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 (IS) 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.
He later wrote on X, formerly Twitter, that he would travel to Brussels on Wednesday to attend a ceremony commemorating the victims alongside Mr De Croo.
"Sweden and Belgium mourn the victims of yesterday's attack together," posted the Belgian leader.
The attack in the Belgian capital began at 19:00 on Monday (17:00 GMT), when a man opened fire in the north of the 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.
The Euro 2024 qualifying match in which Belgium was playing Sweden was abandoned at half-time for security reasons. Some 35,000 supporters had to wait for hours in the King Baudouin Stadium before being evacuated.
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.
The street where the café is located, in central Brussels, has been cordoned off and there was a large police presence there on Tuesday.
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.
The captain of Sweden's football team, Victor Lindelof, wrote on X that he was "shocked and devastated" by Monday night's attack.
"I'm lost for words for the cruelty and inhumanity, I want to send my deepest condolences to the families and friends of those affected," he said.
France's interior minister said in a radio interview that security would be doubled for Tuesday night's football match between France and Scotland in the French city of Lille, which is roughly 100km from Brussels.
UEFA said a moment of silence would be observed at all Euro 2024 qualifying matches on Tuesday, in memory of those killed in Brussels.
Meanwhile in France on Tuesday, an anti-terror prosecutor said that a man who fatally stabbed a teacher at a school in the northern city of Arras last week declared allegiance to IS before the attack. There is no suggestion this was directly connected to the Brussels incident.