Tuesday was Rick Gates’s second day testifying as a witness for the prosecution in the trial of Paul Manafort, his former boss, and he spent a lot of time explaining how money flowed from Ukraine, where he and Manafort had a run of lucrative years doing consulting work for pro-Russian interests, to shell companies in Cyprus, to other shell companies in the Caribbean, and eventually to the United States. In the afternoon, Gates was subjected to a withering cross-examination by Manafort’s lawyer, Kevin Downing, during which he admitted that he’d had an extramarital affair and that he’d repeatedly stolen money from Manafort.

It’s not clear yet how Gates’s testimony will affect the outcome of the trial, in which Manafort is charged with tax evasion, bank fraud, and failing to disclose foreign bank accounts. But his time on the witness stand provided an invaluable public lesson in how tax evasion, money laundering, and political corruption work.

The importance of these phenomena goes well beyond this trial, and also beyond the special counsel Robert Mueller’s broader inquiry into Russia’s activities during the 2016 election. (Among other things, Mueller is widely believed to be looking into whether Donald Trump and his Presidential campaign had any surreptitious financial ties to Russian interests.) The ability of rich people such as Manafort and his oligarchic clients to shuffle money across borders, beyond the purview of tax collectors and law-enforcement authorities, is a huge and intractable problem. In many places, these practices are denuding tax bases, corrupting a large class of professional enablers, and undermining public confidence in the political and financial systems.

According to Gabriel Zucman, an economist at the University of California, Berkeley, as recently as 2014 roughly $7.6 trillion, or eight per cent of the world’s financial wealth, was held in offshore tax havens. In some countries, the proportion is much higher; in the case of Russia, it is more than half. This money can’t be taxed. Zucman calculates the loss to taxpayers is about two hundred billion dollars a year. In the United States, he has estimated, the annual tax loss is about thirty-five billion dollars.

By design, the workings of offshore finance are obscure. It is only when there is a prominent court case or a leak—such as the 2016 Panama Papers, which exposed the dealings of the law firm Mossack Fonseca—that a light is shined on this system’s hidden mechanics. What Gates provided this week was a firsthand account of how the illicit game is played.

From 2008 onward, he explained, Manafort’s consulting firm was paid by Ukrainian businessmen close to Viktor Yanukovych, who was elected President in 2010. Many of these figures already had bank accounts in Cyprus, a Mediterranean island nation that is well known as a refuge for money controlled by Russian and Eastern European oligarchs. Gates described how he and Manafort used a Cypriot law firm to establish bank accounts in the name of shell companies that they controlled but weren’t publicly associated with. Here, courtesy of the Washington Post’s live blog of the trial, is an exchange that Gates had with Greg Andres, the lead prosecutor:

“Did these companies sell a product?” Andres asked Gates. “No,” he replied. “Did they have any employees?” Andres asked. “No,” Gates repeated. “The purpose of the companies was to accept payments and to make payments.”

This sort of thing is standard practice in tax-evasion and money-laundering schemes. So is employing law firms—such as the now defunct Mossack Fonseca—that specialize in maintaining the anonymity of their clients. The Cypriot law firm Chrysostomides “handled everything,” Gates said, including listing the names of locals, rather than the two Americans, as the directors of the shell firms into which the fees from Ukraine flowed.

For a time, Manafort’s arrangements in Cyprus appear to have worked to his satisfaction. Gates testified that, on the directions of his boss, he arranged to have money wired from the Cypriot accounts to vendors in the United States from whom Manafort had bought expensive clothes and other objects. At one point, though, problems arose, Gates said. So, again using the Cypriot law firm, he and Manafort transferred some money to bank accounts in the Grenadines, a chain of small islands in the Lesser Antilles. But, when the banks in the Grenadines were asked to transfer money to companies in the United States, they demanded invoices for the payments—something that the Cypriot banks hadn’t bothered with. At Manafort’s direction, Gates said, he created “modified invoices” and gave them to the banks.

It’s only a certain class of people—the international plutocracy—that encounters these kinds of problems. “About 50% of the wealth held in tax havens belongs to households with more than $50m in net wealth,” Zucman, of Berkeley, noted in an article last year. “These ultra-rich represent about 0.01% of the population of advanced economies.”

These were the type of people whom Manafort was working for in Ukraine, and it’s pretty clear from the life style he adopted that he wanted to join their ranks. After 2014, when the millions of dollars a year he received in fees from Ukraine dried up, he allegedly resorted to bank fraud rather than modify his spending patterns. Gates described how, in 2015, together with Manafort’s accountants, he helped put together bogus financial documents that Manafort then used to obtain bank loans.

According to previous reports, one of the banks that lent money to Manafort in recent years was The Federal Savings Bank, which is based in Chicago. Its president is a man named Stephen Calk. Earlier this year, NBC News reported that Mueller’s team was investigating whether Manafort “promised [Calk] a job in the Trump White House in return for $16 million in home loans.”

Most of the testimony in the Manafort case has focussed on his actions before he joined the Trump campaign. But, toward the end of Andres’s questioning of Gates, the prosecutor showed the witness an e-mail that Manafort wrote to Gates in November, 2016, shortly after Trump was elected. By that stage, Gates was working for Trump’s Presidential transition team. “We need to discuss Steve Calk for Sec of the Army,” Manafort’s e-mail said. “I hear the list is being considered this weekend.” Ultimately, Calk didn’t get a Cabinet post, but earlier in 2016 he had been appointed to an economic advisory council that the Trump campaign set up.

The mention of the e-mail was a stark reminder that Manafort’s hustling, and his lobbying on behalf of the rich and powerful, wasn’t confined to the Ukraine and other foreign countries. When he joined the Trump campaign, he’d long been known as the ultimate swamp creature. Thanks to Mueller and Gates, we now know more about how that swamp operates.