The Southern District of New York, as the United States attorneys office in Manhattan is known, has long displayed independence from the Justice Department in Washington, prosecuting politicians of all political stripes. The office’s reputation for autonomy earned it a nickname: “the Sovereign District” of New York.

Mr. Khuzami’s decision to leave the Southern District of New York caps a consequential 15-month tenure as Mr. Berman’s deputy; most notably, he oversaw the investigation into hush money payments made during the 2016 campaign to two women who had said they had affairs with Mr. Trump. Mr. Cohen pleaded guilty in that case and is scheduled to begin a three-year prison sentence in May.

Mr. Berman, who was appointed in January 2018 by the Trump administration, made Mr. Khuzami his first hire. A prosecutor in the same office earlier in his career, Mr. Khuzami assumed responsibility for the Cohen investigation after Mr. Berman was recused from the case for undisclosed reasons.

With Mr. Khuzami’s departure, Ms. Strauss would assume oversight of any remaining aspects of the Cohen investigation that were subject to Mr. Berman’s recusal; she would not come to the Cohen case cold, as she has been working with Mr. Khuzami on the investigation. Craig A. Stewart, a former Southern District prosecutor now at the law firm Arnold & Porter, will become Mr. Berman’s chief counsel.

Mr. Khuzami’s plans were unclear. He had bounced between the private sector and government service for years. In taking the job as the deputy United States attorney, Mr. Khuzami left behind a lucrative partnership at the law firm Kirkland & Ellis in Washington, where he has lived even while commuting to New York. He had told friends that he had always planned to return home to his family this year, and Mr. Berman said Friday that Mr. Khuzami would return to Washington.