WASHINGTON — By the beginning of 1998, Brett M. Kavanaugh seemed set: a Yale law degree, three judicial clerkships, including one with Justice Anthony M. Kennedy, and, less than a decade out of law school, a coveted partnership at Kirkland & Ellis, a prominent law firm with offices a block from the White House.

At just 32, Mr. Kavanaugh had wrapped up a three-year stint working for his mentor, Ken Starr, on the sprawling Whitewater investigation of President Bill Clinton. The inquiry was finally winding down, and Mr. Kavanaugh believed it was in some ways deeply flawed, telling an audience at Georgetown University Law Center, “It makes no sense at all to have an independent counsel looking at the conduct of the president.”

Then, just as he was starting at the law firm, he went back.

For nearly seven months, Mr. Kavanaugh, now President Trump’s nominee to replace Justice Kennedy on the Supreme Court, worked for Mr. Starr once again, despite his objections, helping to assemble the case that the president had an affair with Monica Lewinsky and obstructed justice by trying to cover it up. It was Mr. Kavanaugh who pressed Mr. Starr to aggressively question Mr. Clinton on the details of his sexual relationship with Ms. Lewinsky and who drafted the section of Mr. Starr’s report to the House that laid out 11 possible grounds for Mr. Clinton’s impeachment.

Mr. Kavanaugh’s decision to return to Mr. Starr’s side plunged him into an immersion course in the brutal ways of Washington combat, forever connecting him to an investigation that Democrats called a partisan witch hunt, foreshadowing the epithet that Republicans now use to describe the efforts of the special counsel, Robert S. Mueller III.