History certainly felt like it was repeating itself. Hours after two associates who helped Rudy Giuliani dig up dirt on Joe Biden were arrested and charged with campaign-finance violations on behalf of at least one unnamed Ukrainian politician, President Donald Trump tepidly defended his personal attorney while distancing himself from what looked like an increasingly sticky legal situation. When asked by a reporter on the White House South Lawn if he thought Giuliani would face an indictment, Trump said he hoped not. On Twitter, he referred to Giuliani as a “great guy and wonderful lawyer,” and called the ongoing investigation into their interactions with Ukrainians a “witch hunt.” Later that day, the two broke bread at Trump’s golf club in Virginia in what was a public display of support at a private club that Trump owned and controlled. Giuliani contends that he has not committed any crimes, but the SDNY is now investigating whether his efforts in Ukraine may have run afoul of the Foreign Agents Registration Act. Over the last few weeks, Giuliani has said that he and the president are as close as ever and that there is no rift between them. But people around the president have grown increasingly wary of their relationship, as it becomes clearer that Giuliani was running what looks like a shadow State Department to deal with Ukraine, and use the power of the presidency to pressure Ukraine into pursuing investigations for political purposes that would benefit Trump.

If all of this sounds familiar, it is because it is nearly identical to the way Trump treated his former personal lawyer, Michael Cohen, after investigators from the SDNY opened a criminal investigation into what they determined were campaign-finance violations stemming from hush money payments made to women alleging affairs with Trump in the last days leading up to the 2016 election.

For a time, the invitations Cohen received to visit Mar-a-Lago, plus Trump’s public support—referring to him as a “good man” and the raid on his office as an “attack on our country”— kept Cohen on his side. It was a side Cohen had wanted to be on, having once told me he would take a bullet for the president. But he saw how Trump slowly started inching away from him and publicly disparaging him once the legal temperature crept higher. It wasn’t long before Cohen broke ranks. He spent more than 70 hours cooperating with the special counsel’s office in its investigation into Russian meddling in the 2016 election; he spent tens of hours talking to the SDNY and ultimately pleaded guilty, though he did not become a formal cooperating witness. Later, he sat with several congressional committees over multiple days to answer their questions.

Cohen’s cooperation has continued since he surrendered to prison in May. A couple of times over the last few months, the New York attorney general’s office has made trips up to the federal penitentiary in Otisville, New York, where Cohen is serving his sentence, in order to gather information as part of its investigation into whether the Trump Organization violated any state laws in reimbursing Cohen for the hush money payments. Attorneys for Cohen have repeatedly contended that Cohen has not only fulsomely cooperated, but that he also has far more to give. “In my judgment, Michael Cohen is now even more valuable than before,” Lanny Davis, one of Cohen’s attorneys, told me over the weekend. “First, in assisting the ongoing congressional impeachment investigation to interpret the Trump code words to lie, as in ‘no quid pro quo, no quid pro quo’ to the E.U. ambassador, when he knows the truth is exactly the opposite. And second, to assist ongoing investigations by state and federal prosecutors.”