For 25 years, Captain George Cusack had terrorised the seas. Now, looking over the waters he knew so well, it was his turn to face terror.

It was 18 January 1674. He had already spent six months in prison – excepting a near-successful escape which saw him shimmy through a chimney, down a rope and into the streets of London.

As the 1676 pamphlet “The Grand Pyrate: or, The Life and Death of Capt George Cusack the Great Sea-Robber” put it: Cusack was found in Holborn, “in Bed with a Woman”, rumoured to be his own sister. Recaptured just before his appearance at the Old Bailey, he stood trial with seven others in his pirate gang. After an hour’s deliberation by the jury, the sentence came down: “That they should be hang’d till they were dead.”

Six of the eight pirates had their sentences commuted to a life of service in the British navy. Cusack was not so lucky.

Over 350 years ago, Cusack helped lead a band of sea-faring criminals accused of robbery, among other offences. Along with Simon Harcourt, the other ringleader, he was paraded from Newgate Prison to the River Thames. At the head of the procession was the marshal of the Admiralty (or his deputy) carrying a silver oar, the symbol of the authority of the High Court of Admiralty.

Cusack and Harcourt were loaded into a barge and taken to Execution Dock, along the Thames in Wapping. There, “vast Multitudes of People” as well as “Ships, Lighters and thousands of Boats expected their Arrival”, according to a penny pamphlet that was printed of the event.

Something else awaited Cusack and Harcourt, as well: the gallows.

*

Once the largest port in the world, London’s port was concentrated in this stretch of river between London Bridge and Limehouse. Known as the Pool of London, it was here that ships came from far-flung trading posts to have their cargo off-loaded, inspected and brought to nearby warehouses (not to mention, of course, sometimes smuggled or stolen).

But the area of Execution Dock, located past the Tower of London on the River Thames, was also used for public hangings.

Not much remains of the place where, for nearly 400 years, dozens of pirates and other criminals were hanged. By the end of the 18th Century, the port’s layout – which consisted of wharves crowded with ships and hundreds of other vessels moored in the river – had become woefully unable to handle the sheer number of ships and amount of cargo necessary. From 1,335 vessels carrying a total of 234,639 tons of goods in 1705, the numbers rose to 3,663 ships and 620,845 tons in 1794.

To provide more capacity, a vast expanse of docks were built. In Wapping, these were the London Docks. Completed in 1815, they specialised in luxury goods like wine and spices and occupied 30 acres. Today, nearly 50 years after the docks’ 1969 closure, the area is mainly residential.

No one can be sure where exactly Execution Dock’s gallows even stood. It was somewhere along the half-mile of shore between the Wapping Old Stairs and Wapping Dock Stairs in East London: possibly at the spot overlooked by The Captain Kidd, a pub named in honour of the most infamous pirate to meet his end here.

But if you go another half-mile east along the Thames, you can get a better sense of what it all might have looked like – at least Execution Dock. On the riverbank just outside the nearly 500-year-old pub the Prospect of Whitby, there’s a sight so strange, it’s surprising it goes relatively unnoticed. It’s a replica of a gallows, complete with hanging noose.

Between 1735 and 1830 alone, Execution Dock saw at least 78 hangings. It was the place of execution for those anyone had been sentenced to death by the High Court of Admiralty – which meant those who had committed a crime on the high seas, usually mutiny, murder… or piracy.

*

Defined by the law as robbery on the high seas, piracy was one of the main concerns of late 17th and early 18th-century Britain. Much of that was because it was a time of peace for Britain. In the mid-1600s, Oliver Cromwell’s invasion of the Caribbean led to constant scuffling between the English and Spanish colonists – and to a boom of privateers, who “established rapine as a patriotic virtue,” writes Joel H Baer in the book British Piracy in the Golden Age: History and Interpretation 1660-1730.

After the peace treaty of 1670, these privateers lost their commissions. Many became pirates.

“A lot of historians have testified to the degree to which crime waves coincided with demobilisation and peace. There are a lot of young men descending on the capital who are used to working together, to plunder, to violence,” says the University of Victoria’s Andrea McKenzie, who researches execution in 17th and 18th-century Britain.

But for the British Empire, it was a particularly inconvenient time for piracy to be booming.

Britain, then building its far-flung network of colonies and its modern system of commerce, needed not only to secure trade routes, but an equally secure reputation as a nation that would not be trifled with (or stolen from). Piracy was seen as an attack not only on trade, but on the reputation of the English as a whole.

One method seen as a robust form of deterrence? Public hangings – like those that took place at Execution Dock.

Of course, this wasn’t only true for pirates.

*

“Capital punishment is underpinning the whole system, really, until the 19th Century,” says criminal justice historian Matthew White of the University of Hertfordshire. “It’s legal terror, effectively; it is preventing crime by means of terror. The original goal of the judicial system is to terrorise everybody by, as they call it, the might of the law.”

For the number of offences on the books that could be punishable by death – roughly 200 in total – the 17th-century criminal code was infamously nicknamed the “bloody code”.

Most of the capital crimes concerned property. And many regarded what would, today, be considered minor crimes. Stealing a handkerchief worth more than a shilling, or 12 pence, was a hanging offence.

“Abducting a child was a misdemeanor, subject only to a minor punishment. But stealing shoes from that child worth more than a shilling was a hanging,” McKenzie says. “It was a law that cared more about property than human life. And it was essentially passed by a ruling landed elite – members of the House of Lords and Commons who say, ‘Someone has been stealing my sheep! Let’s make that a capital offence.’”

But as McKenzie and others point out, the actual application of the law tended to be more nuanced. A death sentence was often commuted to something more lenient, as it was with Cusack’s six gang members.

Even so, there were still plenty of hangings going on across London. Holding executions so publicly was part of the point: capital punishment was designed not only to punish the convict, but to scare everyone else off of committing similar crimes. And the public responded, with crowds often treating hangings as a form of entertainment: some taverns near Execution Dock even had binoculars installed so patrons could watch the proceedings from afar.

Executions in London remained public until 1868; from the 16th well into the 18th Centuries, they were so common that it would have been almost impossible for any Londoner to avoid passing by a hanging at one point or another in their daily lives, says White. That was even truer because, to show the connection between crime and punishment, it was also common for the execution to take place where the criminal act did.

By hanging those who had committed crimes at sea on the Thames at low tide, there was a similar connection between place and point of execution. Though it was probably more because that is where the High Court of Admiralty had a remit, White says.

Some of the other aspects of the punishment, though, had obvious links to a high-seas crime.

*

Hangings always took place at low tide. After the convict had been killed, by tradition, they’d let the tide wash over the body. For the most notorious cases, the bodies would then be left on display.

“The body was normally tarred, and then hung in a cage further down the riverfront” – which was called being gibbetted, White says. “So if you’re arriving to London by vessel, you’re sailing right the way up the Thames. You can’t help but see the bodies hanging by the riverside as you come in” – or as you leave for the high seas.

As English archaeologist Albert Hartshome wrote in his aptly-named 1893 book Hanging in Chains: “It is well known – for there is frequent allusion to it in the literature of the time – that travellers approaching London and other large cities, in the last century, were offended, both in sight and in other ways, by the number of dingy, dead, iron-bound bodies that welcomed them… Belated wayfarers were grieved by the horrid grating sound as the body in the iron frame swunk creaking to and fro.” This included one reverend who wrote in his memoirs that “the only inhabitants of the Isle of Dogs that I ever saw were three murderers hanging from a gibbet.”

The scene even inspired artists. William Hogarth included hanging pirates in his Idle Apprentice series, while Shakespeare even immortalised gibbets in his play King Henry VI: “Against the senseless winds shall grin in vain, Who in contempt shall hiss at thee again.”

*

Captain William Kidd — the namesake pirate of the pub that still sits near the Execution Dock site — was one of those convicts displayed after his execution, even though his experience with piracy was more of a dabble than a career.

He had been working as a privateer when he was asked by the governor of the colonies of New York, New Hampshire and Massachusetts to attack enemy French ships and to hunt pirates. He was not, under any circumstances, to attack ships from any other nation. After a series of catastrophes, including a cholera outbreak that killed a third of his crew and being unable to find the pirates he was hunting, Kidd became desperate. He seized an Indian ship that was flying under a French flag. The captain was English. But giving the ship up meant no booty for his restless crew – and no pay for his investors.

On his return to the colonies, Kidd was arrested for both piracy and murder: in a pique of anger, he’d thrown a bucket at his gunner, who fell and cracked his skull.

In May 1701, Kidd was hanged. Twice. The first time, the rope broke.

That speaks to another terrible aspect of executions at the time, historians say. They weren’t particularly sophisticated.

“The technology of execution was very inept until at least the 1780s,” White says. “There are lots of stories about people being cut down half alive and being resuscitated.” Not until the 1780s did a new technology, called the ‘new drop’, come in – a platform designed to have an automatic release. Before that, a cart would simply be rolled away or a ladder removed.

That lack of sophistication is where one idea about Execution Dock, which White calls an “urban myth”, has come from. Some modern write-ups of the hangings say that pirates were purposely hanged on a shorter rope than other criminals, which meant that the drop wasn’t fast enough to break their neck; instead, death came by strangulation. The macabre result – the victim struggling in the air – was bleakly nicknamed the Marshal’s dance. But there’s no evidence of a shorter rope being used for pirates, or of the gruesome ‘dance’ being anything but an unhappy side effect of poor technology.

Intentional or not, of course, it was a terrible way to die.

Apparently, though, even knowing that was a possible punishment wasn’t enough to warn men like Kidd or Cusack away from their crimes.

And some of those crimes were particularly brutal. Dramatic accounts like Cusack’s, which was immortalised shortly after his death in the fictionalised biography The Grand Pyrate, can make pirates seem like romantic, doomed heroes. That’s particularly true today, when pop culture has helped turn them into a kind of seafaring freedom fighter (or Johnny Depp). But that’s not exactly accurate.

“We choose a few snapshots in which we can identify with these dashing pirates, but that’s unrepresentative,” says McKenzie. “You read a lot about rapes of women, people being forced to serve, a lot of brutality. A lot of people being executed at Execution Dock is for the terrible mistreatment of cabin boys.” One captain even forced his cabin boy to eat his own excrement.

Cusack was no exception. His career as a criminal began when he led the crew of the Virginia-bound Hopewell of Tangier to mutiny. Shooting several of the sailors, he set the wounded, along with the captain and chief mate, adrift in the ocean.

Then he ransacked the ship, split the possessions with the other mutineers and threw overboard all of the records he could find. Not even the Bible was immune. When one of his crew members pleaded with him to save it from the waves, he retorted, “Cowards, what do you think to go to Heaven and do such actions as these? No, I will make you officers in Hell under me.”

Another time, Cusack and his men baited a 24-gun ship by pretending to be shipwrecked on an old sailboat in the Irish Sea. Out of mercy, the captain took them aboard. It was the wrong move, of course: Cusack’s men took over the ship and forced the ship’s crew into the creaky boat.

According to the version of his dying speech that was printed in a circulated pamphlet, only when facing the gallows at Execution Dock did Cusack finally become repentant… sort of.

“When the Prisoners came out of the Barge, Captain Cusacke, when he first set his foot on Shore, lifting up his Eyes to Heaven, said, Farewell Earth! This is the last time I shall ever tread on thee,” the pamphlet writes. “Then turning to some Friends, they discoursed privately a little while, and then went severally to Prayers; which being Concluded, the Captain first Ascended the Fatal Ladder with the Rope about his Neck, and spake.”

It was common for criminals, before their execution, to give what was called a “dying speech”. (They’d often have it circulated beforehand, as well, to make sure that the papers had the right version). Over the hubbub of the crowd, Cusack insisted he hadn’t done what he was accused of: “I was never guilty of the Blood of any Person living, unless without my knowledge in a Lawful War”.

But even so, he warned the crowd, “Take warning by my Death how you lead your Lives: Ill actions must expect miserable Ends… The Company of Loose Women, and a Covetous desire of getting Money, have been and are the two Mischievous Rocks on which men Shipwrack their Souls, and generally the means that lead them to this Deplorable End which ye now see prepared for me.”

The executioner pushed him off the ladder. As the crowd dispersed, Cusack’s body kept hanging as the tide came up to meet him.

This story is a part of BBC Britain – a series focused on exploring this extraordinary island, one story at a time. Readers outside of the UK can see every BBC Britain story by heading to the Britain homepage; you also can see our latest stories by following us on Facebook and Twitter.

And if you liked this story, sign up for the weekly bbc.com features newsletter, called “If You Only Read 6 Things This Week”. A handpicked selection of stories from BBC Future, Earth, Culture, Capital, Travel and Autos, delivered to your inbox every Friday.