Lynn D. Compton, a lawyer and later a judge who was best known for leading the prosecution of Sirhan B. Sirhan for the assassination of Robert F. Kennedy — that is, until more than 20 years later when his heroism during World War II was made public in “Band of Brothers,” the best-selling book by Stephen E. Ambrose and the subsequent HBO miniseries, died on Saturday at his home in Burlington, Wash. He was 90.

His death was announced by his family.

Mr. Compton, who was known as Buck, was a deputy district attorney for Los Angeles County in California for nearly 20 years and a specialist in major felony cases. In 1969, as chief deputy district attorney, he won a conviction in the Sirhan case for murder in the first degree, scornfully dismissing the defense’s contention that Mr. Sirhan, who is still in prison, had been psychologically unstable and thus incapable of premeditating the June 1968 shooting of Senator Kennedy at the Ambassador Hotel in Los Angeles. Kennedy had just won California’s Democratic presidential primary.

“I say throw them all out in one big bag,” Mr. Compton said in his summation, referring to the claims of the psychologists and psychiatrists who testified for the defense. “I say reject all the tests. I think it would be a frightening thing for justice in this state to decide a case of this magnitude on whether he” — Mr. Sirhan — “saw clowns playing patty-cake or kicking each other in the shins in an ink blot test.”

He went on: “I’ve heard that Charles Dickens wrote in a book that ‘the law is an ass.’ I think the law became an ass when it let the psychiatrist get his hand on it.”