BRUSSELS — Modern Europe is built on the idea of binding countries together by stripping away borders. But in the space of just a week, the coronavirus pandemic has led countries to reimpose hard frontiers across the continent, challenging the European Union's basic model in ways that may reverberate for years.

Leaders of the 26 European countries that are part of what is normally a free-movement zone also agreed Tuesday to shut their external borders to most nonresidents for the first time.

“We are faced with a serious crisis, an exceptional one in terms of magnitude and nature,” European Council President Charles Michel said late Tuesday. “We want to push back this threat. We want to slow down the spread of this virus.”

Other leaders phrased it in martial terms: “We are at war,” French President Emmanuel Macron said Monday.

The European Commission on March 16 recommended a “temporary restriction on non-essential travel” to the European Union for 30 days. (Ursula von der Leyen via Storyful)

Until last week, citizens of the E.U. could move across the continent with ease, even as the virus slowly spread across its population. Just as a resident of Maryland can easily pack bags and head to Virginia, so, too, could a Pole cross into Germany.

As of Tuesday, 19 countries in Europe’s previously border-free area had imposed new border controls.

The about-face in Europe is proving as disruptive as it would be if American states imposed border controls on one another. And since Europe’s countries are no longer built for self-sufficiency and no country manufactures or grows everything it needs, the effect of the internal blockade could quickly become catastrophic.

Trucks trying to enter Poland from Germany were backed up 25 miles on Tuesday as Polish border guards checked drivers’ temperatures, overall health and documents before allowing them through.

Meanwhile, Estonia, Latvia and Lithuania, whose only connection to the rest of the E.U. is through Poland, have had to mount a rescue operation by air and sea to help their citizens trying to get home. The Baltic states have deployed the Latvian national airline and even chartered ferries so their nationals can scramble to German ports and sail around Poland.

“Conditions have been very miserable,” said Latvian Foreign Minister Edgars Rinkevics.

“We need uninterrupted cargo flow, because our economy is suffering, like every country around the world,” he said.

Leaders of the E.U. institutions in Brussels, watching national leaders erect walls all around them, have been desperately trying to keep the internal borders open, at least partially. One major risk, they say, is that medical supplies necessary to combat the coronavirus will pile up in trucks that have been stopped at national frontiers, sapping Europe’s ability to fight the crisis.

E.U. citizens are stranded “within Europe. And this needs to stop,” European Commission President Ursula von der Leyen said Tuesday. “We have to keep cross-border transport of supplies going, in particular that of medical products.”

European leaders spent three hours Tuesday talking about the border issues and traffic pileups. They agreed to create special lanes for trucks to get waved through or receive prioritized screening.

But Europe’s collective-action problem is not just a matter of logistics. France and Germany last week threw up political borders around crucial medical equipment produced in their territory, banning the export of protective gear, including masks, to any other country, even Italy, which is struggling with shortages. After entreaties by E.U. leaders, the countries loosened their bans, but not before the message was sent to Italians and others: In a crisis, don’t count on your neighbors to help you out.

“For the E.U., this is really an existential threat,” said Stefano Stefanini, an Italian former diplomat who now works as a security consultant in Brussels. “If the E.U. is seen as not having done enough or not having cared enough or not having been up to the challenge, people will double down on the question of what is the E.U. for.”

Stefanini, 72, described an anxious daily routine of calling through a list of family members and friends in Italy to check on them. A brother is a doctor in his native city of La Spezia, on the Italian Riviera — outside the hardest-hit region of the country but at a hospital that is on the edge of its capacity, he said. Even in his mother’s memories of wartime Italy, Stefanini said, rare was the absolute lockdown the country was now facing, apart from moments when fighting was directly overhead.

“The sense of European solidarity is shaken when your neighbor refuses to export medical equipment,” he said.

China has moved quickly to step into the gaps in European generosity, airlifting masks, respirators and other critical supplies to Rome’s Fiumicino Airport on Thursday, a day when France and Germany had yet to offer assistance to Italy. Chinese media has played up the international assistance efforts, even though the government’s halting response to the initial viral outbreak was seen as helping fuel the pandemic.

Just outside E.U. borders, Serbian President Aleksandar Vucic reacted bitterly to news that the E.U. this weekend imposed a bloc-wide export ban on equipment to protect medical workers, such as masks and gowns. The restriction is intended to help jump-start countries inside the E.U. to come to one another’s assistance, but it left neighbors in the lurch.

“International solidarity does not exist. European solidarity does not exist,” Vucic said. “The only country that can help us is China.”

Some observers caution that challenges in the heat of the crisis may seem less important in months or years as the E.U. adjusts — perhaps constructively — to a new world in which pandemics can challenge its basic operating model. They point to the 2015 migration crisis — when borders also sprouted up within Europe only to fade away — as an example of a problem that did not ultimately lead to the collapse of the bloc.

Still, said Daniela Schwarzer, the head of the German Council on Foreign Relations, the initial resistance by national governments to cooperate with one another “doesn’t look good.”

The E.U. institutions “are trying to push the more cooperative handling of the crisis, but as long as governments don’t really play along, this is very difficult,” Schwarzer said. “If not handled in a very cooperative way, this will increase the losses in terms of people, in terms of wealth.”

Further challenging Europe’s fundamental, open-bordered model, some policymakers warn, internal borders may be difficult to pull down again. Unlike the 2015 migration crisis, when there was a clear influx of people that eventually subsided, the virus will probably offer no clear off-ramp.

“When are we going to say that we are ready to lift those restrictions and bans?” asked Rinkevics, the Latvian foreign minister. “If we, say, reopen schools or all those facilities that have just closed, what if there is a new spike because we have not been able to completely get rid of it? This is something we are not yet discussing in national governments.”

The border closures were serving “a legitimate goal” — to slow the spread of the virus, he said. “But how long can we do it?”

Quentin Ariès in Brussels and Loveday Morris in Berlin contributed to this report.