Mauner Mahecha is a family man. A single father, he dotes on his three young girls and provides for his ailing mother, too. But in testimony delivered over a two-week federal trial in Miami, the court heard little about his home life. That’s because, when the 34-year-old wasn’t tending to his children, he was running drugs and masterminding the construction of a fleet of submarines to silently ferry tons of cocaine beneath the seas. And he would have pulled it off if it hadn’t been for an unassuming engine mechanic who risked his life to ensure the narco-subs never left shore.

On Monday a Miami jury delivered a guilty verdict for one of Mahecha’s associates. But far more interesting than the prosecution of one of his underlings was the detail the trial revealed about Mahecha’s criminal mind—and his underwater engineering marvels.

Mahecha spared no expense. He had a fat R&D budget and spent millions of dollars building each submarine. These aren’t the crude semisubmersibles that drug runners have used for years to cruise just below the ocean’s surface. Those vessels can’t dive to avoid detection and are often just cigarette boats encased in wood and fiberglass. Mahecha’s Kevlar-coated submarines, by contrast, can submerge to 60 feet, go 10 days without refueling, and glide underwater for up to 18 hours at a clip. Unbelievably, they were made by hand in the mangrove swamps of Colombia and Ecuador, in desolate outposts with no access to electricity.

When analysts with the U.S. Office of Naval Intelligence got their first close look at one of Mahecha’s captured submarines, a 74-foot-long beast with twin propellers, they devoted 70 fawning pages to describing its capabilities. “The streamlined hull, diesel-electric propulsion system, and fuel ballast system design all show a significant level of technical expertise and knowledge of submersible operations,” they crowed in a confidential Naval Intelligence white paper marked “For Official Use Only.”

Mahecha is no MacGyver, and he didn’t design the subs himself. For help with construction and operations, he recruited talent from the Colombian navy, using promises of fast cash to lure five current and former seamen to work on the project in his remote jungle hideouts. He filled out his building crew by corrupting local welders, electricians, and fiberglass installers, according to papers filed in the case. Finally, he brought in local muscle to secure the sites, arming his men with automatic rifles and grenades.

Together, the ragtag team constructed at least three submarines. Perhaps the most important aspect of the subs’ design was how they were powered: They were loaded with batteries—249 Chinese-made, lead-acid batteries were found on one sub alone—and ran quiet. So quiet that the U.S. Navy worried that they were “potentially difficult to detect acoustically or by radar.” Mahecha was building an underwater cocaine pipeline, an undetectable narco-submarine delivery system straight from the mind of Lex Luthor. Indeed, U.S. and Columbian authorities may have never learned of his sophisticated operation if it weren’t for Genert Quintero.

It was 2009, and Quintero was training at the Colombian navy’s marine infantry base in Coveñas. A skilled outboard-engine mechanic, Quintero was walking to lunch on base when an SUV pulled up beside him. Two senior officers he knew jumped out to make small talk. A few weeks later, the same two officers were back. This time, sitting inside the SUV, retired Lt. Col. Oscar Augusto Gutierrez Garcia made his pitch. “He told me they had a very important job,” Quintero recalled from a witness stand in Miami’s federal courthouse. “He told me it involved work on a submarine in Ecuador. He told me it was the opportunity of a lifetime for me.”

In some ways it was. After 23 years with the navy and nearing retirement, Quintero was earning a modest workingman’s salary. Just one round-trip submarine mission for Mahecha’s operation would pay him at least $50,000, Quintero recalled.

After Mahecha’s officers made their pitch, Quintero dutifully reported the meetings to a superior he trusted in the Armada Nacional, the Colombian navy. He in turn confided in a friend, an American stationed in Colombia for the U.S. Drug Enforcement Administration. Together with a Colombian naval intelligence unit and elite investigators with the Cuerpo Técnico de Investigación, the Colombian and American law enforcement agents stitched together a plan for their newly minted undercover operative.

Quintero accepted the job offer, as coached. He retired from the navy and began training as a crew member on one of Mahecha’s coke-toting submarines. He was now on the inside of an ingenious criminal enterprise.

Like any good HR department, the drug traffickers provided an introductory packet to new employees. “The area where the project is being developed is tropical and there are lots of bugs,” it advised. It asked Quintero to get “vaccinated against yellow fever,” warned him about the possibility of experiencing claustrophobia during long weeks spent in the cramped submarine and, ominously, requested his blood type. From the beginning, Quintero testified, he knew the danger his work posed. “I was fully aware I could never make mistakes,” he said. “They would have made me and my family disappear.”

The DEA agents who operated in Bogotá and Cartagena were not about to allow that to happen. Working with their Colombian counterparts, they opened a massive investigation in spring 2010 and began exploiting the names, cellphone numbers, and secret locations that Quintero was regularly turning over to investigators. The Colombian authorities got court authorization and recorded thousands of hours of phone calls. They secretly videotaped crew members at cafes, airports, even amusement parks. They monitored suspects’ email accounts. And then in the summer of 2010, they started to move in.

Police raided Mahecha’s multiple cocaine-processing labs and discovered more than 4 tons of cocaine—easily worth tens of millions of dollars. They seized all three of his submarines in dramatic jungle raids, including an armed assault on one sub just hours before its maiden voyage. And they piled on the arrests, even netting the drug kingpin himself. He had gone on the run and finally surrendered to authorities in Panama in 2011.

The Justice Department extradited Mahecha to the United States in February 2012, and he pleaded guilty to conspiracy to manufacture and distribute cocaine three months later. He’s now serving an 18-year sentence in a Florida prison.

Mahecha’s entire crew took a fall, too. Of the 22 submarine pilots, navigators, builders, accountants, and security guards indicted by the Justice Department, 20 have pleaded guilty. One is still at large, and the final defendant, Carlos Almanza, was convicted Monday in the Miami courtroom.

Almanza is one of the former Colombian naval officers. When he refused a plea deal and demanded a jury trial, prosecutors were forced to show their cards. They brought in the undercover informant, Quintero, to testify and were forced to admit that he is now living stateside. “Why did you come to the United States?” asked Assistant U.S. Attorney Kurt Lunkenheimer. “For the safety of my family,” Quintero replied. “We felt threatened.”

For much of the past two weeks, Courtroom 11-2 has been the site of a grim reunion. One after another, former members of the Colombian navy have been testifying against their old sub mate, Almanza, and explaining how they had hoped to cash in by piloting the tricked-out drug subs up the Pacific.

Mahecha was supposed to join his navy recruits on the witness stand, but prosecutors pulled his name at the last minute. For now, the drug kingpin will keep his side of the story to himself—how it was that one of South America’s most ambitious drug smugglers got played by an engine repairman.