James R. Leavelle, the big man in the white Stetson who epitomized the horrors of the assassination of President John F. Kennedy in one of the most famous photographs of all time — the killing of Lee Harvey Oswald by Jack Ruby — died on Thursday at a hospital in Denver. He was 99.

His death was confirmed by his daughter, Karla Leavelle.

Mr. Leavelle, a veteran Dallas homicide detective who had survived the Japanese attack on Pearl Harbor in 1941, was handcuffed to Mr. Oswald and was leading him through a police station basement on Nov. 24, 1963, when Mr. Ruby, a nightclub owner, stepped out of the crowd and pumped a fatal bullet into the prisoner. The shooting, with Mr. Oswald’s pained grimace and Detective Leavelle’s stricken glower, was chillingly captured by Robert H. Jackson of The Dallas Times Herald in an iconic photograph that won the Pulitzer Prize the following year.

Moments earlier, he and Mr. Oswald had had an eerie exchange, Mr. Leavelle often later recounted. “Lee,” he recalled saying, “if anybody shoots at you, I hope they are as good a shot as you.”

To which, he said, Mr. Oswald replied: “You’re being melodramatic.”

At the time, two days after President Kennedy had been gunned down in a motorcade through downtown Dallas, Mr. Oswald was a suspect in the killing of a Dallas police officer, J.D. Tippit, and had yet to be conclusively tied to the assassination. But after Detective Leavelle asked him whether he had shot the police officer, Mr. Oswald aroused the detective’s suspicions by insisting, “I didn’t shoot anybody,” as if, Mr. Leavelle later recounted, there had been another shooting as well.