Pirates have long been portrayed as mysterious adventurers with questionable morals, but in reality, a pirate’s life was even more devious than any Hollywood movie or beloved children’s novel dares to tell. Lawlessness was pervasive on the open sea, but despite its darkness, there was a set of rules adhered to by even the most ruthless buccaneers: the Pirates’ Code.

A 17th-century pirate, Bartholomeus de Portugees, is believed to be behind the code’s origins. He also may have been the first pirate to be captured by a Spaniard ship, and escape using jugs of wine.

The Pirates’ Code was a series of pragmatic regulations that varied from ship to ship. As reported by The New Yorker in 2007, each ship was “governed by what amounted to simple constitutions that … laid out the rights and duties of crewmen, rules for the handling of disputes, and incentive and insurance payments. The code was eventually employed by some of the most famous pirates in history.

Yet no pirate worth his salt would lack a legacy told in the form of a tall tale. For Bartholomeus, that tale is the 1904 adventure novel, “Sea-Wolves of Seven Shores,” in which author Jessie Frothingham describes a highly dramatized scene involving the Portuguese pirate’s daring escape from capture.

As the story goes, Bartholomeus and his crew were captured by a Spanish ship. Robbed of their own ship’s immense bounty, the Portuguese men’s fate was uncertain. That is, until a mighty storm forced the ship to calmer waters, leaving it off the Yucatan coast near the city of Campeche.

By cruel fate, this was the very cite of one of Bartholomeus’s murderous rampages years prior. Its people welcomed the Spanish ship, but were determined to make Bartholomeus pay for his cruel deeds. And so, the dramatized Bartholomeus had to act fast.

“He found two large earthen jars such as are used by the Spaniards for transporting wine, and these he stopped very tight so that no water could leak in,” Frothingham writes. As night fell, Bartholomeus plunged a knife into the chest of a guard and threw the jars into the ocean. The telling continues: “Hanging on to his improvised life-preserver he managed to half drift and half swim … and succeeded in reaching the shore before daylight without being detected.”

Later in the story, washed ashore and trekking his way through the jungle, Bartholomeus encounters a band of pirates. Luckily, they are friends, not foes. He and his former comrades plot their revenge on the Spaniards. They sail off into the sunset, preparing for plundering — this time, one might imagine, with a deeper appreciation for Spanish wine.