The interim Manhattan U.S. attorney, Geoffrey Berman, recused himself from his office’s investigation into President Donald Trump’s longtime lawyer, Michael Cohen, according to people familiar with the matter, leaving the highly sensitive probe in the hands of his deputy.

The deputy U.S. attorney, Robert Khuzami, whom Mr. Berman hired upon taking office in January, previously worked as a partner at law firm Kirkland & Ellis LLP and led the enforcement division of the Securities and Exchange Commission during the Obama administration. He also spent 12 years as a Manhattan federal prosecutor, including as chief of the securities fraud unit.

It is unclear why Mr. Berman stepped back from the Cohen matter, but some legal experts have suggested that Mr. Berman’s involvement could have appeared improper, given his potential nomination by Mr. Trump to a permanent job in the post.

In 2016, Mr. Berman donated $2,700 to Mr. Trump’s presidential campaign, according to public records. Former federal prosecutors say it isn’t uncommon or considered improper for U.S. attorney candidates to have made political donations.

Even with Mr. Berman’s recusal, the investigation of Mr. Cohen, a broad inquiry that includes questions about a payment he made to a former porn star shortly before the 2016 election to conceal her alleged affair with Mr. Trump, has escalated the uncertainty around the leadership of one of the most prestigious prosecutors’ offices in the nation.