He also encouraged unhappy newsroom employees to seek jobs elsewhere — an offer that many reporters and editors took him up on. During his tenure at The Journal, more than a dozen left for new jobs at The Washington Post and The New York Times.

News of Mr. Baker’s exit on Tuesday caught the newsroom by surprise: No announcement was made to the staff besides a formal news release issued by the Murdoch-owned News Corporation, which purchased Dow Jones, the paper’s parent company, in 2007.

News Corp. declined to make Mr. Baker or Mr. Murray available for comment.

Some of the complaints about Mr. Baker emanated from The Journal’s Washington bureau, which had bristled at his leadership role, given his past as an outspoken critic of President Barack Obama. Mr. Baker seemed friendlier toward Mr. Trump; during an Oval Office interview last year, the editor made small talk with the president about golf and greeted Ivanka Trump with a reminder that the two had socialized in the Hamptons a few weeks prior.

That Mr. Baker’s comments became public was itself a sign of internal discord: A transcript of the Oval Office interview, which Mr. Baker had conducted along with other Journal reporters, was leaked to a rival news outlet. Later, a leak of late-night emails from Mr. Baker — in which he admonished Journal reporters and editors for their coverage of a Trump rally — triggered a fresh round of newsroom consternation.

Mr. Baker, 56, who had worked at The Financial Times and The Times of London before joining The Journal, appeared unmoved by the complaints. He defended his newspaper’s political coverage as objective, rigorous and fairer to the new administration than that of its rivals. And it cannot be said that The Journal, during his watch, has not made Mr. Trump squirm: The paper has been at the forefront of reporting on payments involving the president and women who have said that they once had sexual relationships with him.