LOS ANGELES — Samuel Mayerson, the prosecutor who took newspaper heiress Patricia Hearst to court for shooting up a Southern California sporting goods store in 1974 _ and then successfully argued for probation, not prison, for the kidnap victim-turned terrorist _ has died at age 97.

Mayerson, who later went on to a decades-long career as a judge, died Monday at his Palos Verdes home, family friend Jerry Freisleben told The Associated Press on Thursday.

Although arguably best known for the Hearst case, Mayerson also prosecuted and, later as judge, presided over hundreds of criminal cases during a legal career that spanned more than 60 years.

A legal expert who was known for having little patience for attorneys who entered his courtroom unprepared, Mayerson was widely praised for fairness and well liked for his otherwise cheerful personality.

"He was very devoted to the law, he did a lot of research on all his cases," said retired AP Special Correspondent Linda Deutsch, who covered the Southern California case of Hearst and William and Emily Harris, the heiress' kidnappers-turned-criminal cohorts.

"He was also very friendly and very supportive of the press," Deutsch added.

Although he made his mark as a prosecutor and a judge, Mayerson's first love was flying.

He was 8 or 9, he recalled, when he decided he would someday become a pilot. After graduating from community college in his native Corpus Christi, Texas, he enlisted in the Army Air Corps in 1941.

After the United States entered World War II, he flew missions over North Africa and Italy, providing air coverage for ground troops.

He moved to Los Angeles after the war where he earned his law degree from the University of Southern California and joined the Los Angeles County District Attorney's Office in 1952. He would eventually head the office's felony crimes section.

Hearst had already been convicted of bank robbery in San Francisco and sentenced to prison when Mayerson prepared to prosecute her and William and Emily Harris in 1977 for a bungled sporting-good-store robbery.

The three fugitives had escaped after Hearst raked the front of the store with gunfire, nearly hitting the manager.

Although Mayerson said he was surprised when she offered to plead no contest to some of the charges, he accepted the deal and joined her attorneys in arguing she should be sentenced to probation.

He pointed out she had already been sentenced to prison on other charges and was the victim of a heinous crime and abused by the radical terrorist group the Symbionese Liberation Army, which had abducted her from her apartment days before her 20th birthday.

Mayerson went on to win convictions against the Harrises, who were members of the Symbionese Liberation Army.

After retiring from the district attorney's office, Mayerson worked briefly in private practice and in his most prominent case in that role was as co-counsel for Noah Dietrich, the former right-hand man to reclusive billionaire Howard Hughes.

Dietrich had been named executor of Hughes' estate in a will the courts later determined was a fake.

Mayerson was appointed to the Municipal Court bench by Gov. Jerry Brown in 1981 and served as a judge for most of the rest of his life.

After retiring in 1994, Mayerson returned to the bench under a state program using retired judges to ease the backlog of Superior Court cases. He continued to handle a full schedule in that capacity until retiring permanently in 2015 at age 92.

Survivors include his son, Matthew; daughter, Julie Mayerson Brown, and grandchildren Mickey Brown, Madeline Mayerson Adler, Samuel Brown and Anna Mayerson.

Ruth Mayerson, his wife of more than 60 years, died in 2016.