Fixer. The title wasn’t a formal one, but Michael D. Cohen wholeheartedly embraced the role as a lawyer at the Trump Organization. It amounted to serving as chief problem solver for Donald J. Trump, offering Mr. Cohen an unusually up-close view of his boss’s personal and professional lives.

Although Mr. Cohen was not a central part of the Trump family business, he was often at Mr. Trump’s side in the decade before he became president, including helping him sort out difficulties leading up to the 2016 election. Most famously, he helped arrange hush money payments to two women — including the pornographic film actress Stormy Daniels — who claimed to have had affairs with Mr. Trump.

His unflinching loyalty to his boss often went unreciprocated. And it was this imbalance that left the two men on perilous ground last April, after the Federal Bureau of Investigation raided Mr. Cohen’s home, office and hotel room. The searches were part of an inquiry, in the office of the United States attorney for the Southern District of New York, that grew out of Robert S. Mueller III’s examination of Russian election meddling.

Mr. Cohen would ultimately plead guilty to multiple crimes, and is scheduled to begin serving a three-year prison term on May 6. After months of indecision, he turned on Mr. Trump last summer and has since spoken to the Southern District prosecutors about the Trump family business and more, as well as providing information to the office of the special counsel, Mr. Mueller.