By Kayla Epstein
BBC News, in court
In October 2016, lawyer Keith Davidson was promised "the easiest deal" he had ever done in his life.
On Tuesday, he found himself on the stand in the first criminal trial of a former US president, reading aloud profanity-ridden text messages that led to that deal.
Prosecutors have charged Donald Trump with 34 felony counts of falsifying business records, for allegedly covering up evidence of this hush-money payment to adult film star Stormy Daniels.
Mr Davidson testified about his role in brokering the payout to keep Ms Daniels silent about an alleged sexual encounter with Mr Trump.
Mr Trump has pleaded not guilty to the charges, and denies having sex with Ms Daniels.
Text messages displayed in court on Tuesday showed the haggling over Ms Daniels' payout kicked into high gear after the October 2016 release of the Access Hollywood tape.
The infamous 2006 recording captured Mr Trump boasting on a hot mic that he could grab women's genitals without their consent because he was famous.
Prosecutors have argued Mr Trump was desperate to bury Ms Daniel's story in the aftermath of the tape's release, because an additional allegation of a sexual encounter with an adult film star could doom his presidential bid. They have cast the case as one of election interference.
Or, as Mr Davidson put it in a text message to National Enquirer editor Dylan Howard after the tape was released, Ms Daniels "talking…is the final nail in the coffin….but he really is f— already."
"Trump is f—," Mr Howard texted back. "Wave the white flag. It's over people!"
Mr Davidson said that he first met Ms Daniels in 2011, but that he did not start working with her on the hush money payout until the waning days of the 2016 election.
Mr Davidson said he was drawn in by a woman named Gina Rodriguez, who was already negotiating with AMI, the National Enquirer's publisher, to purchase the rights to Ms Daniels' story.
The deal with the publisher eventually fell through.
After AMI "washed their hands" of the deal, the publisher handed it off to Cohen, Mr Davidson testified. "In essence,'' he said, Cohen stepped into their shoes.
Ms Rodriguez did not want to deal with Cohen, who Mr Davidson said could be unpleasant to work with. So he assumed the role of Ms Daniels' lead negotiator.
Mr Howard connected the two lawyers via text message.
"Connecting you both in regard to that business opportunity," Mr Howard wrote to Cohen and Mr Davidson. "Spoke to the client this AM and they're confirmed to proceed with the opportunity. Thanks. Dylan."
Prosecutors showed an email from Mr Davidson to Cohen, dated 11 October 2016, confirming that the "settlement sum is $130,000."
Legal agreements were attached to the email.
Mr Davidson had trouble actually getting Cohen to send the funds, he testified, and at one point threatened to quit the deal.
Eventually, in late October, Cohen wired the cash.
Earlier in the day, prosecutors showed the record of a wire transfer of $130,000 that Cohen made to an account controlled by Mr Davidson.
Prosecutors say that Mr Trump broke the law when he reimbursed Mr Cohen for the hush money payment, but falsely recorded those reimbursements as legal expenses pursuant to a retainer agreement.
They allege that he did this to influence the outcome of the 2016 election, by hiding damning information from the public.
They aimed to use Mr Davidson's testimony and the flurry of texts sent before the 2016 election to bolster that case.
This was not the only payout Mr Davidson negotiated for a client.
In the summer of 2016, he also brokered a "catch-and-kill" scheme with the National Enqurier for the Playboy model Karen McDougal, who alleged she had an affair with Mr Trump.
Several pages of text messages show exactly how the exclusive rights to Ms McDougal's story was purchased by AMI, in a process known as "catch and kill."
In June 2016, Mr Davidson texted Mr Howard, "I have a blockbuster Trump story."
His attention piqued, Mr Howard replied: "Talk 1st thing. I will get you more than ANYONE for it. You know why…"
Earlier in the trial, David Pecker, who owned the National Enquierer testified that he, Mr Trump, and Cohen had reached an agreement to use the tabloid to bolster Mr Trump's presidential campaign and help head off negative stories.
Negative stories exactly like Ms McDougal's and Ms Daniels.'
For all the reams of messages unveiled today, prosecutors may have already displayed most revealing text messages between Mr Davidson and Mr Howard earlier in the trial.
Around 3 am on the night Mr Trump shocked the world and won the presidency, Mr Davidson frantically texted his tabloid friend: "What have we done?"