After being sworn in as attorney general in March 2021, Merrick B. Garland gathered his closest aides to discuss a topic too sensitive to broach in bigger groups: the possibility that evidence from the far-ranging Jan. 6 investigation could quickly lead to former President Donald J. Trump and his inner circle.

At the time, some in the Justice Department were pushing for the chance to look at ties between pro-Trump rioters who assaulted the Capitol on Jan. 6, 2021, his allies who had camped out at the Willard Hotel, and possibly Mr. Trump himself.

Mr. Garland said he would place no restrictions on their work, even if the “evidence leads to Trump,” according to people with knowledge of several conversations held over his first months in office.

“Follow the connective tissue upward,” said Mr. Garland, adding a directive that would eventually lead to a dead end: “Follow the money.”

With that, he set the course of a determined and methodical, if at times dysfunctional and maddeningly slow, investigation that would yield the indictment of Mr. Trump on four counts of election interference in August 2023.

The story of how it unfolded, based on dozens of interviews, is one that would pit Mr. Garland, a quintessential rule follower determined to restore the department’s morale and independence, against the ultimate rule breaker — Mr. Trump, who was intent on bending the legal system to his will.