Last August, when the Obama administration returned $440 million from frozen Iranian bank accounts to Iran as part of the international deal to shutter Iran’s nuclear weapons program, Giuliani said, “I call that trading with the enemy.”

Now Guiliani is defending in U.S. federal court a wealthy Turkish businessman who sought to flout U.S. and international sanctions on behalf of Iran’s Supreme Leader Ayatollah Khamenei. Last month Giuliani joined the legal defense team of Reza Zarrab, a Turkish-Iranian dual national who is under indictment for, you guessed it, trading with the enemy.

Zarrab, who is being held in New York, has pleaded not guilty to four counts of conspiring to process hundreds of millions of dollars in financial transactions for Iranian businesses or Iran’s government from 2010 to 2015.

Iran’s money man

According to the indictment, Zarrab’s staff drafted a letter to Ayatollah Khamenei in 2013, praising him for “neutralizing” U.S. sanctions. The letter expressed the hope that “the efforts and cooperation of the zealous children of Islamic Iran will result in an upward increase in the progress of our dear nation in all international and financial arenas.”

Zarrab and his network of companies sold gold to the Iranians and generated phony invoices for food and medicine. The transactions enabled the Iranians to evade international sanctions and move large amounts of money in and out of the country, ostensibly for its nuclear program, according to a Turkish prosecutor’s brief reviewed by Reuters.

Zarrab was first arrested in Turkey in December 2013 and charged with bribing cabinet ministers, triggering a national scandal. Zarrab’s commercial ventures reportedly generate over $11 billion annually.

Turkish president Recep Erdogan denounced the charges as a baseless conspiracy of his rivals. He fired the police and prosecutors who brought the case. Though charges against Zarrab and 13 other defendants were dropped, three ministers in Erdogan’s government had to resign. Erdogan and his family were personally implicated in Zarrab’s operation.

With a national referendum on Erdogan’s powers coming up for a vote on April 16, the Zarrab affair remains a vulnerability for the incumbent strongman. Getting the charges against Zarrab dismissed before April 16 would fortify his regime.

Giuliani for the defense

Zarrab thought he was untouchable until his arrest at Miami International Airport on March 19, 2016 as he took his pop star wife and daughter on vacation to Disneyland.

You might think Rudy Giuliani, the Iran hawk, would support U.S. law enforcement efforts to bring Zarrab to justice and expose the mechanism Iran used to evade sanctions on its nuclear program.

Think again.

Giuliani is seeking to spare Reza Zarrab from American justice. Late last month, Giuliani and former U.S. Attorney General Mike Mukasey stated in court papers that they are seeking a “diplomatic” resolution of Zarrab’s case, which apparently means dropping the charges.

Giuliani and Mukasey recently traveled to Turkey to meet with Erdogan. They made sure to inform Attorney General Jeff Sessions of their itinerary. Sessions would make the ultimate decision about whether charges are dropped or not.

Erdogan also appealed to Obama’s Attorney General Loretta Lynch in an unsuccessful effort to get the charges dropped.

Another arrest

Meanwhile, the U.S. Attorney’s Office in New York is forging ahead with its investigation.

On March 27, U.S law enforcement arrested Turkish state banker Mehmet Attila and accused him of “a years-long scheme to violate American sanctions laws by helping Reza Zarrab to use U.S. financial institutions to engage in prohibited financial transactions that illegally funneled millions of dollars to Iran.”

Giuliani’s role in Zarrab’s defense team was announced two days later. When prosecutors asked about Giuliani’s role in Zarrab’s defense, Zarrab’s chief lawyer stated in court papers, “That information quite frankly is none of the government’s business.”

Last week, the judge in the case asked Giuliani and Mukasey to disclose who is paying their legal fees.

While many questions remain, one thing is clear: Giuliani the Iran hawk has become Rudy the Iran fixer.

What is going on here?

The Zarrab case illuminates an old story — Giuliani’s willingness to abandon his stated principles for large sums of money—and a new story: corrupt practices of the Erdogan regime and its ties to Trump insiders.

Think of Erdogan’s Turkey as a cousin of Putin’s Russia: an authoritarian regime with an interest in Syria that has money to throw at its problems in Washington. As with Putin, Trump and his entourage are ready to deal.

In 2016, the Erdogan government covertly enlisted former lieutenant general Michael Flynn as its agent in Washington in return for a $500,000 fee that Flynn initially failed to disclose. Flynn was later forced to resign as National Security Adviser for dissembling about a pre-inauguration meeting with the Russian ambassador.

Erdogan has also hired Giuliani’s firm as its agent on other issues.

Trump, meanwhile, fired U.S. Attorney Preet Bharara, who oversaw the prosecution of Zarrab. According to the New York Times, Giuliani has recommended Mukasey’s son, Marc L. Mukasey, to become the next United States attorney in Manhattan.

If Giuliani has his way, the younger Mukasey would be in charge of the prosecution of the man his father is trying to set free.

Will Trump deliver?

David L. Phillips, a former senior adviser to the U.S. State Department who first exposed Flynn’s relationship with the Erdogan government in the Huffington Post, says Trump may release Zarrab as a favor to Erdogan.

“Trump is transactional,” Phillips told AlterNet in an interview. “Erdogan will be incensed if the U.S. deepens its security cooperation with Syrian Kurds in the battle for Raqqa and to establish a safe zone on the Syria-Turkey border. Trump could try to placate Erdogan by abandoning the prosecution of Zarrab, whose testimony may implicate Erdogan and his family in criminal activity.”

“Giuliani’s intervention,” Phillips said, “undermines rule of law and the administration of justice. It unmasks Giuliani as a mercenary devoid of principles.”

Aykan Erdemir, a former Turkish parliamentarian now working for the Foundation for Defense of Democracy, told AlterNet, “If the Zarrab and Attila cases go forward, the evidence that becomes public has a big potential to hurt Erdogan’s image and political future. Not only will the Turkish and global public pay attention to the case, dissidents in Turkey will have the chance to make the case that this evidence is admissible in Turkey.”

As Trump steps into the role of wartime commander in chief, he needs to mollify Erdogan, because the United States is expanding assistance to Syrian Defense Forces, which are dominated by the Syrian Kurds Erdogan fears.

Erdogan wants to make the Kurds and the domestic political scandal go away. In Trump’s transactional world, Iranian money laundering by Erdogan’s cronies may be of secondary importance to preserving U.S. access to Turkey’s Incirlik air base and maintaining Erdogan’s support in the expanding U.S. war in Syria.

Meanwhile, Rudy Giuliani stands ready to help facilitate the corrupt bargain — for a fee.