The New York Times has not seen a copy of Mr. Trump’s letter — which was drafted at the urging of Mr. Trump during a pivotal weekend in May at the president’s private golf club in Bedminster, N. J. — and it is unclear how much of the letter’s rationale focuses on the Russia investigation. The Justice Department turned over a copy of the letter to Mr. Mueller in recent weeks.

The long Bedminster weekend began late Thursday, May 4, when Mr. Trump arrived by helicopter, joined by a trio of advisers — his daughter Ivanka; his son-in-law Jared Kushner; and Mr. Miller. It rained during part of the weekend, forcing Mr. Trump to cancel golf with Greg Norman, the Australian golfer. Instead, Mr. Trump stewed indoors, worrying about Mr. Comey and the Russia investigation.

The inquiry had already consumed the early months of his administration. Mr. Trump was angry that Mr. Comey had privately told him three times that he was not under investigation, yet would not clear his name publicly. Mr. Comey later confirmed in testimony to Congress in June that he had told the president that he was not under investigation, but said he did not make it public because the situation might change.

Mr. Miller and Mr. Kushner both told the president that weekend that they were in favor of firing Mr. Comey.

Mr. Trump ordered Mr. Miller to draft a letter, and dictated his unfettered thoughts. Several people who saw Mr. Miller’s multi-page draft described it as a “screed.”

Mr. Trump was back in Washington on Monday, May 8, when copies of the letter were handed out in the Oval Office to senior officials, including Mr. McGahn and Vice President Mike Pence. Mr. Trump announced that he had decided to fire Mr. Comey, and read aloud from Mr. Miller’s memo.