WASHINGTON — If it were not for a now famous scene in a hospital just blocks away from the White House, it is unlikely that James B. Comey would have been standing in the Rose Garden on Friday to be introduced as President Obama’s nominee for the director of the F.B.I.

Mr. Comey was serving as acting attorney general in the Bush administration’s Justice Department when he became the central figure in the most dramatic constitutional crisis of the nation’s 12-year war on terrorism, and his role in the events surrounding that showdown on March 10, 2004, have shaped his public life and reputation.

His confrontation with White House officials that March night in the cramped confines of Attorney General John Ashcroft’s room at George Washington University Hospital has since made him widely lionized as a guardian of the Constitution for resisting pressure to rubber-stamp a National Security Agency surveillance program that he and others at the Justice Department believed violated the law.

A senior Obama White House official said on Friday that Mr. Comey’s part in the 2004 crisis was “an important factor in the president’s decision making” when he selected him to succeed Robert S. Mueller III as director of the Federal Bureau of Investigation.