Almost 700 years ago, the overwhelmed physicians and health officials fighting a devastating outbreak of bubonic plague in medieval Italy had no notion of viruses or bacteria, but they understood enough about the Black Death to implement some of the world’s first anti-contagion measures.

Starting in 1348, soon after the plague arrived in cities like Venice and Milan, city officials put emergency public health measures in place that foreshadowed today’s best practices of social distancing and disinfecting surfaces.

“They knew that you had to be very careful with goods that are being traded, because the disease could be spread on objects and surfaces, and that you tried your best to limit person-to-person contact,” says Jane Stevens Crawshaw, a senior lecturer in early modern European history at Oxford Brookes University.

A 14th-century Italian fresco of the plague, from the Stories of St Nicholas of Tolentino. DeAgostini/Getty Images

The First Quarantine

The Adriatic port city of Ragusa (modern-day Dubrovnik) was the first to pass legislation requiring the mandatory quarantine of all incoming ships and trade caravans in order to screen for infection.

The order, which miraculously survived in the Dubrovnik archives, reads that on July 27, 1377, the city’s Major Council passed a law “which stipulates that those who come from plague-infested areas shall not enter [Ragusa] or its district unless they spend a month on the islet of Mrkan or in the town of Cavtat, for the purpose of disinfection.”

Mrkan was an uninhabited rocky island south of the city and Cavtat was situated at the end of the caravan road used by overland traders en route to Ragusa, writes Zlata Blazina Tomic in Expelling the Plague: The Health Office and the Implementation of Quarantine in Dubrovnik, 1377-1533.

Tomic says that some medical historians consider Ragusa’s quarantine edict one of the highest achievements of medieval medicine. By ordering the isolation of healthy sailors and traders for 30 days, Ragusan officials showed a remarkable understanding of incubation periods. New arrivals might not have exhibited symptoms of the plague, but they would be held long enough to determine if they were in fact disease-free.

READ MORE: Pandemics that Changed History

10 Gallery 10 Images

Significance of a 40-Day 'Quarantino'

The 30-day period stipulated in the 1377 quarantine order was known in Italian as a trentino, but Stevens Crawshaw says that doctors and officials also had the authority to impose shorter or longer stays. The English word “quarantine” is a direct descendent of quarantino, the Italian word for a 40-day period.

Why 40 days? Health officials may have prescribed a 40-day quarantine because the number had great symbolic and religious significance to medieval Christians. When God flooded the Earth, it rained for 40 days and 40 nights, and Jesus fasted in the wilderness for 40 days.

Stevens Crawshaw says that even before the arrival of the plague, the biblical notion of a 40-day period of purification had crossed over into health practices. After childbirth, for example, a new mother was expected to rest for 40 days.

READ MORE: How U.S. Cities Tried to Halt the Spread of the 1918 Spanish Flu

Did the Quarantine Laws Work?

Even with the new quarantine law, Ragusa continued to be hit hard by aftershock outbreaks of the plague in 1391 and 1397. As a maritime city that survived on trade, it would have been impossible to completely wall off Ragusa to disease without gutting the economy.

But even if the quarantine measures didn’t fully protect Ragusans from disease, Stevens Crawshaw believes that the laws may have served another purpose—restoring a sense of order.

“There are risks with any sort of epidemic of social breakdown, widespread panic, or complacency, which can be just as dangerous,” says Stevens Crawshaw. “There are a lot of emotions that need to be acknowledged and preempted and that was part of public health policy 600 years ago as much as it is now.”

PHOTOS: Innovative Ways People Tried to Protect Themselves From the Flu

The Plague of Florence in the 14th century, as described by Giovanni Boccaccio. Bettmann Archive/Getty Images

Ragusa Also Built the First Plague Hospital

Quarantine wasn’t the only tool in Europe’s ongoing battle with the plague, which would periodically ravage the continent well into the 17th century. Ragusa was also the first city to set up a temporary plague hospital on another island called Mljet. This new type of state-funded treatment facility would soon become known throughout Europe as a lazaretto.

Stevens Crawshaw, who wrote a book about plague hospitals, says that the name lazaretto is a corruption of the word Nazaretto, the nickname for the lagoon island upon which Venice built its first permanent plague hospital, Santa Maria di Nazareth.

The lazaretto served two functions, as a medical treatment center and a quarantine facility. It was a way to compassionately care for both new arrivals and local citizens who fell sick with the plague while keeping them isolated from the healthy. At a lazaretto, plague-infected patients would receive fresh food, clean bedding and other health-promoting treatments, all paid for by the state.

“They’re quite a remarkable early public health structure into which the government has to invest huge sums of money,” says Stevens Crawshaw. “Regardless of whether there’s a plague in Venice, these hospitals are permanently manned, ready and waiting for incoming ships that may be suspected of carrying an infectious disease.”

READ MORE: The First Time the Plague Broke Out in the US, Officials Tried to Deny It