For three days last week, counterterrorism officials and experts from dozens of countries gathered in Brussels for a conference on a threat quietly gathering in the city around them.
They passed through an airport whose vulnerabilities had been assessed by Islamist militants. Some even stepped off a subway system already marked as a soft target. They heard a top Belgian official warn that the recent arrest of a suspect in last fall's Paris attacks had exposed only the edge of a larger network.
The suspect, Salah Abdeslam, "was ready to restart something from Brussels" four months after he went underground, said Didier Reynders, the Belgian foreign minister. At the conclusion of the massive manhunt, authorities had "found a lot of weapons, heavy weapons . . . and we are seeing a new network of people around him in Brussels."
The arrest of Abdeslam appears to have set off a race between security officials in Belgium and a terrorist cell that must have known that it had limited time to act. On Tuesday, the authorities lost.
The attacks, which killed at least 31 people and left about 250 others injured, were promptly claimed by the Islamic State, the terrorist group that has unleashed a series of external plots as its territory in Syria and Iraq has begun to shrink. Belgian officials described the devastation as a "black day," darker than any the country had seen since World War II.
The carnage also exposed the extent to which Belgium has become the Western hub of a terrorist threat that has spread from the Islamic State's strongholds in Syria across the Middle East and deep into Europe.
Belgium has seen a larger share of its Muslim population leave to fight in Syria than has any other Western country. The Molenbeek district of Brussels, the capital, is a particularly fertile breeding ground for militants, including several involved in the Paris attacks that killed 130 people last year.
Belgium was the first country in Europe to face an attack on its soil tied to the Islamic State: a shooting at a Jewish museum in Brussels that killed four people nearly two years ago. But despite that early wake-up call, the carnage Tuesday showed how woefully vulnerable Belgium remains.
"It's kind of astonishing how hard it is for bureaucracies to be galvanized without direct experience of a major terror attack," said Daniel Benjamin, a former top counterterrorism official at the State Department. "The tragedy is that country after country has had to learn this the hard way," he said, describing the Islamic State's support network in Belgium as "probably the most fully developed [terror] infrastructure in Europe."
A small nation of 11.2 million, Belgium has had at least 470 of its citizens enter Syria to join the fighting since the civil war began there four years ago. That is triple the number of suspected fighters who have attempted to get to Syria from the United States. And the ratio of Belgian fighters - about 45 for every 1 million citizens - is more than twice that of its neighbor France.
Even before Tuesday's attacks, those statistics made counterterrorism officials concerned that Belgium would face a dangerous "boomerang effect."
"When you have these large numbers of foreign fighters, ISIS can cherry-pick the best ones to give them training and dispatch them to their home country to carry out attacks," said Bruce Hoffman, a terrorism expert and director of Georgetown University's Center for Security Studies, using an alternate name for the Islamic State. "Even if ISIS dispatches only 10 percent of these fighters, you've got the foundation of a potentially highly effective terrorist cell and support network."
Initially, exporting violence did not appear to be one of the Islamic State's priorities. For months after its declaration in 2014 of a restored caliphate, the organization's energies seemed focused on expanding and controlling its territory in Syria and Iraq.
But U.S. officials and experts believe that the Islamic State has shifted its strategy over the past year as it has lost territory and momentum under a barrage of U.S.-led airstrikes and ground operations by Western-backed militias.
In its statement claiming responsibility for Tuesday's attacks, the group suggested that the subway and airport bombings were a response to "aggression against the Islamic State." Video messages posted by Belgian Islamic State veterans in recent weeks have warned of new attacks against Europe.
"If you do not leave the Muslims alone, you will never be able to sleep at night," a fighter identified as Abu Shaheed al-Belgiki warned in Belgian-accented Dutch. "Know that we only needed six soldiers to shake all of Paris." There were 10 attackers in Paris.
About 118 of Belgium's departed fighters are believed to be back in Europe - part of a much broader stream of militants returning from Syria that has unnerved European security services.
Belgium's relatively small security force is widely regarded as among the least effective in Europe, and it has struggled to penetrate the country's homegrown Islamist network or track the movements of Islamic State veterans.
It took Belgian officials four months to locate Abdeslam, the Brussels native and alleged lone survivor of the cell that carried out the Paris attacks on Nov. 13. Europe's most-wanted fugitive was finally captured March 18, even though he had been hiding out in the Belgian capital, not far from his childhood home.
In the past two years, at least seven other Islamist terrorist attacks or foiled plots have taken place on Belgian soil or have been linked to Belgian nationals. Several of the alleged culprits previously fought for the Islamic State or other jihadist groups in Syria or Iraq.
Mehdi Nemmouche, a French native with dual French-Algerian citizenship, had spent a year fighting in Syria before returning to Europe, crossing multiple borders and then opening fire at the Jewish Museum of Belgium in 2014. Police would link him to a video claiming responsibility for the attack and displaying a homemade Islamic State flag before his arrest in France.
In January 2015, an assailant who killed shoppers in a Paris kosher market used a gun purchased from Belgian arms dealers. That same month, police in the eastern Belgian city of Verviers killed two radical Islamists who were plotting what authorities described as a major terrorist attack that was to include the beheading of a police officer.
Last August, a former Belgian resident and Syria veteran tried to kill passengers on an Amsterdam-to-Paris train before being subdued by two U.S. servicemen and another American who happened to be aboard. The suspect, Ayoub el-Khazzani, got on the train in Brussels and carried weapons obtained from a Belgian supplier.
On Nov. 13, the deadliest terrorist attack in French history was carried out in Paris by 10 assailants led by an Islamic State veteran from Brussels's Molenbeek district.
Because of Europe's open borders, Belgium's terrorism problem now threatens all its neighbors, Hoffman said.
"In Europe, individual countries are only as strong as their most vulnerable neighbor," Hoffman said. "You can have a strong surveillance network and counterterrorism machinery, but if a neighboring country doesn't have the same resources or the same perception of the threat, that becomes a launchpad that can be exploited by groups that want to project terrorist attacks elsewhere."
In his remarks at the Brussels security conference, Foreign Minister Reynders said Abdeslam, the apprehended Paris suspect, had told investigators he was supposed to take part in the suicide bombing of a soccer game at the Stade de France but didn't follow through.
"We don't know why," Reynders said at the conference, which was also attended by Nicholas J. Rasmussen, director of the U.S. National Counterterrorism Center.
Reynders said Abdeslam was being questioned by investigators and was eager to avoid extradition to France. But it is not clear whether the suspect revealed any information about other nodes of the Islamic State's network in Europe or whether Belgian authorities had a chance to act.
Reynders's comments came during a panel Sunday at a hotel just blocks from the Maelbeek metro station, where at least 20 people were killed two days later. "We need to dismantle a lot of cells, a lot of groups of terrorists, a lot of networks," Reynders said.
Julie Tate contributed to this report.