Brett M. Kavanaugh’s career had traveled a most unusual path through Washington’s scandals. He had overseen an investigation into whether President Bill Clinton’s deputy counsel, Vincent Foster, had been murdered or committed suicide. He also had laid out the grounds for impeaching Clinton in the wake of the Monica Lewinsky affair.

After working on the recount that put George W. Bush in the White House, Kavanaugh played a central role in Bush’s administration and was rewarded when his boss nominated him to a federal circuit court. But Democrats held up his nomination, concerned he was too partisan, and his meteoric rise stalled.

As Kavanaugh’s nomination languished for a second year, Bush came to him with a question: What type of person should be nominated to the Supreme Court? Kavanaugh said the “tiebreaker” should be someone who is “capable of convincing his colleagues through persuasion and strategic thinking,” Bush wrote in his memoir. Based partly on that advice, Bush picked John G. Roberts Jr., who today is chief justice. A year later, Kavanaugh garnered enough votes to become a federal judge.

Now it is Kavanaugh who has been nominated by President Trump to the Supreme Court, and — if Republicans do not unite behind him — Democrats are prepared to excavate all of their prior arguments against him, along with a review of his 12 years on the bench as a conservative-leaning judge.

Kavanaugh can come across as the un-Trump, as he did in a recent commencement address at Catholic University’s law school, where he talked about living “on the sunrise side of the mountain,” staying humble, being prepared and saying about his hero, Bush, “Love the guy!”

His friendships span the political spectrum. At reunions with his seven Yale Law School housemates, he is the only Republican.

As his sometimes rocky career path demonstrates, Kavanaugh also has years of experience with Washington’s darker, partisan side, navigating conspiracy theories and congressional roadblocks. After clerking for three judges, including retiring Justice Anthony M. Kennedy, Kavanaugh received a bracing introduction to the city’s culture when he was hired by Independent Counsel Kenneth W. Starr in 1994 and tasked with investigating Foster’s death.

“Brett was the smartest of the smartest,” said Robert Bittman, who worked with Kavanaugh in Starr’s office.

Foster died in a Virginia park on July 20, 1993, of a gunshot wound, leaving behind a note saying he “was not meant for the job or the spotlight of public life in Washington. Here, ruining people is considered sport.” An initial investigation declared Foster’s death a suicide, but conspiracy theorists speculated the Clintons were somehow connected to his death. Starr charged Kavanaugh with reinvestigating the matter.

Kavanaugh interviewed witnesses, forensic experts and a medical examiner and concluded there was no doubt Foster had killed himself.

Kavanaugh’s performance, however, included a setback. Appearing before the Supreme Court for the first and only time in his career, he argued Foster’s attorney should be compelled to turn over notes of his conversation with Foster shortly before the suicide. The Supreme Court voted 6-3 to reject Kavanaugh’s position, citing attorney-client privilege.

Kavanaugh’s next task was even more sensitive.

Starr was delving into Clinton’s relationship with White House intern Lewinsky. Clinton had been accused of lying in a lawsuit when he denied having sexual relations with Lewinsky. Kavanaugh urged Starr to take a hard line in questioning Clinton unless the president resigned or confessed perjury, according to records of the independent counsel cited in “The Death of American Virtue: Clinton Vs. Starr,” by Ken Gormley.

Clinton “has disgraced his Office, the legal system, and the American people by having sex with a 22-year-old intern and turning her life into a shambles — callous and disgusting behavior that has somehow gotten lost in the shuffle. He has committed perjury. . . . He has tried to disgrace . . . this Office with a sustained propaganda campaign that would make Nixon blush,” Kavanaugh wrote, according to the records obtained by Gormley.

Kavanaugh suggested a list of questions for Clinton that would reveal the most graphic details of the relationship, including, “If Monica Lewinsky says that you [had oral sex] on occasions in the Oval Office, would she be lying?”

Starr’s team wrote a sexually explicit narrative of the Clinton-Lewinsky affair. Starr said in an interview he chose Kavanaugh to be the primary author of a section on the grounds for a possible impeachment of the president because Kavanaugh would perform the task dispassionately.

“This was not a man on a mission,” Starr said. “This was a legal document of great potential moment that needed to be very carefully crafted.so I was looking to one of the office’s most talented lawyers — of superb and balanced judgment — to take the lead in drafting. But of course it became a product of the office, including yours truly

When Starr prepared a report outlining Clinton’s action, Kavanaugh objected to including the sexual details, according to “Shadow,” a book by The Washington Post’s Bob Woodward. Kavanaugh lost the argument, and pages of details were included.

“The narrative shows how pathetic Clinton is,” Kavanaugh said, according to Woodward’s book. “That he needs therapy, not removal. It’s a sad story. Our job is not to get Clinton out. It is just to give information.”

Kavanaugh later said he had qualms about the way the investigation unfolded. In an article in the Minnesota Law Review, he argued a president should not have to face civil lawsuits or investigations during his time in office because they would be “time-consuming and distracting.”

After leaving Starr’s office, Kavanaugh worked on the Bush campaign, including the Florida recount, and then worked for the president for five years, including as senior associate counsel in the White House Counsel’s Office. He met and later married Bush’s personal secretary, Ashley Estes.

In 2003, Kavanaugh was chosen by then-White House counsel Alberto Gonzales to handle a sensitive matter. The Justice Department planned to argue the federal government did not have a “compelling” interest in the University of Michigan considering race as an admissions factor. Such an argument could have undermined an affirmative action program at the school. Bush told Gonzales he did not want to get involved in a “mess over race” and that the administration should not take a position, according to Gonzales’ autobiography.

In the end, the Justice Department followed Bush’s wishes, as conveyed by Kavanaugh. Gonzales said in an interview he chose Kavanaugh for the job because he was “willing to take on difficult issues” but stressed he did not know how Kavanaugh personally felt about affirmative action.

During this time, Kavanaugh helped vet judicial nominees, including to the Supreme Court. For the vacancy Roberts filled in 2005, Kavanaugh told Bush that Samuel A. Alito Jr., now on the court; J. Michael Luttig, a conservative judge who sat on the U.S. Court of Appeals for the 4th Circuit; and Roberts would all be “solid justices.”

Kavanaugh became Bush’s staff secretary, often traveling the world with the president. In 2003, Bush nominated Kavanaugh to be a judge on the U.S. Court of Appeals for the District of Columbia Circuit, widely seen as a steppingstone to the Supreme Court. But Democrats, citing Kavanaugh’s work on the Starr report and for Bush, blocked his nomination until 2006.

Sen. Patrick J. Leahy (D-Vt.) said at the time Kavanaugh “has failed to demonstrate his capacity for independence,” but the Republican-controlled Senate approved the nomination by a 57-36 vote.

Kavanaugh’s wait to become a judge was over, but it had long seemed his destiny.

His mother, Martha, a public school teacher in Washington, and his father, Edward, both got their law degrees in 1978 when he was a teenager. Martha Kavanaugh became the first “Judge Kavanaugh” in the family when she joined the Maryland state bench in 1993.

At Georgetown Preparatory School in Maryland, Kavanaugh excelled in sports and in the classroom. He was two years ahead of Trump’s first Supreme Court pick, Neil M. Gorsuch. While Gorsuch was a debate enthusiast, Kavanaugh was a jock — captain of the basketball team and a defensive back in football. But he also took seriously the message of his Jesuit education and talks openly about his Catholicism.

“Being a ‘man for others,’ ” childhood friend Scott McCaleb said of the motto. “For a lot of us, those are just words, but for Brett, it’s a way of life. That defined him.”

Kavanaugh serves meals at a Catholic Charities program in Washington. With his wife and two daughters, he is a regular presence on Sundays at The Shrine of the Most Blessed Sacrament in Northwest Washington.

“He’s equally comfortable debating the most complex constitutional issues as he is discussing the incoming recruiting class for the University of Maryland basketball team,” said McCaleb, now a Washington lawyer.

On the District of Columbia Circuit for the last 12 years, Kavanaugh’s collection of nearly 300 opinions puts him in the middle of the other judges appointed by Republican presidents. Kavanaugh has been able to “toe a moderate line” while issuing predominantly conservative opinions, said legal scholar Adam Feldman.

He is “far to the right, but not at the edge of the spectrum,” said Feldman, the Empirical SCOTUS founder who has analyzed Kavanaugh’s opinions and the ideology of his colleagues.

In a speech at Notre Dame Law School last year, Kavanaugh lamented that too many Americans view the Supreme Court’s rulings as partisan and “pre-baked” based on the party of the president who nominates the justice or the justice’s individual policy preferences.

“That bothers me, and I have been thinking about the causes of that, and whether there are at least some modest cures,” Kavanaugh said.

Like the late justice Antonin Scalia, Kavanaugh supports looking at the original meaning and text of the Constitution and statutes, but there are some instances when he considers the pragmatic aspects of cases and is less ideological.

Kavanaugh has consistently ruled in favor of businesses and employers and for restraining government bureaucracy. He has mostly sided with the government when it comes to military commissions used to prosecute terrorist suspects and against defendants in criminal cases. In a case involving a notorious Washington house party with a mystery hostess, Kavanaugh was in the minority in finding police officers acted legally and reasonably when they arrested 21 people for trespassing. On appeal in January, Kavanaugh’s position was adopted by a unanimous Supreme Court.

His record on abortion has already brought criticism from both sides of the issue. Kavanaugh ruled against an immigrant teen in federal custody seeking to immediately terminate her pregnancy. But some conservatives were angered that he did not go as far as another District of Columbia Circuit judge who said the teen had no constitutional right to an elective abortion.

Alice Crites in Washington contributed to this report.

Read more on Trump’s Supreme Court pick