NEW YORK (AP) — For Michael Cohen and Donald Trump, it's always been about money and loyalty.
Those were guiding principles for Cohen when he served as more than just a lawyer for Trump during the developer's rise from celebrity to president-elect.
Cohen brokered deals for the Trump Organization, profited handsomely from a side venture into New York City's real estate and taxi industries and worked to make unflattering stories about Trump disappear.
Money and loyalty also drove Cohen to make guilty pleas this past week in a spinoff from the swirling investigations battering the Trump White House.
Feeling abandoned by Trump and in dire financial straits, the man who once famously declared that he would "take a bullet" for Trump now is pledging loyalty to his own family and actively seeking to cooperate with special counsel Robert Mueller's investigation.
The unraveling of their relationship was laid bare Tuesday when Cohen pleaded guilty to eight criminal charges and said in federal court that he broke campaign finance laws as part of a cover-up operation that Trump had directed.
In the days after Cohen's guilty plea, two close associates — the magazine boss who helped him squash bad stories and the top financial man at the president's business — have been granted immunity for their cooperation.
These moves could have a ripple effect on the legal fortunes of Cohen and, perhaps, Trump.
For years, Cohen was a fixture in Trump's orbit.
Working alongside Trump and Trump's three adult children — Don Jr., Ivanka and Eric — in Trump Tower, Cohen took on a number of roles for the developer, including emissary for projects in foreign capitals and enforcer of Trump's will.
At times a bully for a family-run business, Cohen was known for his hot temper as he strong-armed city workers, reluctant business partners and reporters.
He was there in the lobby of Trump Tower in June 2015 when his boss descended an escalator and changed history by declaring his candidacy for president. But Cohen's place in Trump's political life ended up being peripheral.
Cohen did become a reliable surrogate on cable TV — he created a viral moment by repeating "Says who?" when told Trump was down in the polls — and founded the candidate's faith-based organization.
But Cohen was never given a prominent spot in the campaign.
And despite telling confidants that he thought he had a shot at White House chief of staff after the election, Cohen was never given a West Wing job.
He remained in New York when Trump moved to Washington.
Cohen found ways to profit from the arrangement, making millions from corporations by selling access to Trump, but felt adrift and isolated from Trump, according to two people familiar with his thinking who spoke on condition of anonymity because they were not authorized to discuss private conversations.
But early one April morning, more than three dozen federal agents raided Cohen's home, office and hotel room.
A chief focus for investigators was Cohen's role in making payments during Trump's campaign to women who claimed they had sex with Trump, and whether campaign finance laws were violated.
In the fall of 2016, weeks before the election, Cohen had set up a limited liability company in Delaware to hide the deal he made to silence the pornographic film actress Stormy Daniels about an affair she said she had with Trump.
Worry grew within the White House about what had been seized.
That April day, Trump berated the raid as "an attack on all we stand for."
But then, in a "Fox & Friends" interview, Trump began to dramatically play down his relationship with Cohen.
"I have nothing to do with his business," Trump said, asserting that Cohen was just one of many lawyers and was responsible for "a tiny, tiny fraction" of Trump's legal work.
A dispute soon broke out between Cohen and Trump over who would pay the former fixer's mounting legal bills.
Holed up in a Park Avenue hotel after his apartment flooded, Cohen began to worry about his financial future, according to the two people.
By all appearances, Cohen's lifestyle was lavish.
He bought a $6.7 million Manhattan apartment last fall, though the sale didn't close until April and no one could move in until the summer.
With bills piling up for his team of expensive lawyers, the suddenly unemployed Cohen began to tell confidants that he was worried about his job prospects and ability to support his family.
Meanwhile, the broadsides from the White House kept coming.
Trump and Cohen had long stopped speaking, but word would get back to the lawyer that the president was belittling him.
The president's attorney and frequent attack dog Rudy Giuliani went from calling Cohen "an honest, honorable lawyer" in May to deriding him as a "pathological liar" in July.
Cohen began wondering to friends whether loyalty with Trump had become a one-way street, the people said.
Eager to hit back and attempt to regain some hold on the story, Cohen hired Lanny Davis, a former Bill Clinton attorney, to be his public relations lawyer.
Davis began striking back at the White House and lobbed a clear warning shot at the president when he released a secret recording of a conversation in which Trump appears to have knowledge about hush-money payments to former Playboy model Karen McDougal, who also alleged an affair with the developer.
Cohen was embraced by the cable news networks as an irresistible foil to Trump.
Some on the left styled him as a star of the resistance.
Cohen's camp made some effort to play into the role, reaching out to Watergate whistleblower John Dean and, after Cohen's plea, establishing an online fundraising tool that seemed to predominantly receive backing from liberals.
Cohen, who could get about four years to five years in prison, is due to be sentenced Dec. 12.
Davis has strongly telegraphed that Cohen is willing to cooperate with Mueller's investigation.
But a deal has yet to be struck and there are doubts about what Cohen can prove or whether the special counsel would want to rely on an untrustworthy witness.
Cohen has stayed out of sight and has remained emotional since his plea, according to the people close to him.
The attacks from Trump have continued.
"If anyone is looking for a good lawyer, I would strongly suggest that you don't retain the services of Michael Cohen!" Trump tweeted Wednesday.