When Spanish civil servants got wind that someone was sweeping up the priceless treasure of a 200-year-old frigate from the ocean floor, it triggered a real-life escapade full of naval pursuits and secret airlifts - like something from a comic book adventure.

And that is what it has now become, after one of those suit-and-tie sleuths convinced Spain's best-known graphic novelist that together they should tell the tale of the modern-day treasure hunt.

In 1804, a British fleet opened fire on the Spanish ship Nuestra Señora de las Mercedes, causing the death of 250 people of the 300 on board – and the loss of half a million silver and gold coins.

That incident became known as Battle of Cape Santa Maria and led to Spain declaring war on Britain. Within a year came the Battle of Trafalgar and the defeat of the Spanish and French fleet.

Two centuries later, US firm Odyssey Marine Exploration announced it had made the largest discovery of underwater treasure in history - but would not reveal the name or location of the shipwreck.

The deep-ocean exploration company used robotic rovers to suck 17 tons of treasure from the seabed – before spiriting it away to Florida on a secret flight out of Gibraltar under the Spanish authorities' noses in 2007.

"With the coordinates that the Navy handed us, it hasn't taken us too long to find the site. Let's get going, lower Triton!"

"Triton descending - to 200m... 850m... 930m... 1010... 1015... sea-bed"

"There's nothing there"

"Turn 45 degrees east. A bit more to the left... slowly."

"Wait! Stop - here it is, we've got it."

It would take five years for a team of Spanish civil servants to wrest back the treasure, which now sits in a museum in Cartagena on the south-east coast.

But the story of how they got it back is itself quite a tale.

Guillermo Corral, a career diplomat who was working in Spain's culture ministry in 2007, felt his experience of the legal fight had potential as an adventure story, so he contacted graphic novelist Paco Roca.

Mr Roca soon saw parallels with classic comic-book sagas such as Tintin and Corto Maltese, and the two men wrote The Treasure of the Black Swan, in reference to the codename that Odyssey gave the shipwreck before the Spanish authorities worked out that it was in reality the Mercedes.

"We have a boat we know nothing about, that may or may not be Spanish.... and an immense treasure that has been outside Spain for weeks, almost certainly in the US. And you are suggesting that we do exactly what, Alex?"

"I was fascinated by the historical aspect. The attack on the Mercedes triggered war between the British and Spaniards and the entry into Spain of Napoleon's army," Mr Roca told the BBC in an interview.

Most shipwrecks tend to be spread over large areas. But the Mercedes exploded in spectacular fashion when a British cannonball pierced the ship's gunpowder magazine, causing the ship to sink very quickly.

That meant its treasure of Spanish escudos and pieces of eight reached the seabed in one very specific spot.

Mr Roca claims he did not intend to create a story of comic-book goodies versus baddies. But he admits that he and Mr Corral were "critical of the company's manner of extracting the treasure, using a kind of giant vacuum cleaner and destroying the wreck site, which is also a marine cemetery".

"That's the difference between a real archaeologist and a treasure hunter: one is moved by the history; the other the economic aspect," he said.

In real life, the dispute went to a court in Tampa, an appeal in Florida, and eventually all the way to the US Supreme Court. But the graphic novel doesn't take place in a courtroom.

"They're coming..."

"I can't believe it ... we've got it, we've got it."

How fact was turned into fiction
The book depicts a cloak-and-dagger pursuit of information to work out where and how Odyssey was sweeping the ocean for treasure.

But in the fictionalised version the exploration company is called Ithaca.

Other details are changed too.

In the comic book the ship's GPS is switched off to confuse Spanish authorities, who later use a stolen copy of Gibraltar airport manifests to work out where the company is flying planes to and from.

So where does the truth end and fiction take over?

"That's for each reader to decide for themselves," says his co-writer, Guillermo Corral.

"What I can say is this: everything is the truth. And if it isn't? Well, it could have been."