Updated

Judge Stephen Reinhardt of the U.S. 9th Circuit Court of Appeals died Thursday in Southern California, a court spokesperson confirmed. He was 87.

Reinhardt died of a heart attack during a visit to a dermatologist in Los Angeles, the court spokesperson said.

“As a judge, he was deeply principled, fiercely passionate about the law and fearless in his decisions,” 9th Circuit Chief Judge Sidney Thomas said in a statement. “He will be remembered as one of the giants of the federal bench.”

Eric Garcetti, Mayor of Los Angeles, called Reinhardt "one of the greatest jurists of our time. A searingly brilliant Angeleno and true progressive icon."

Reinhardt was appointed by President Jimmy Carter in 1979 and went on to become the sixth longest-serving judge on the court.

Reinhardt was a liberal stalwart on the bench, which he used to try to help the underdog, including immigrants and minorities, The Los Angeles Times reported.

Last year he wrote in an opinion that a Trump administration order to deport a man who entered the country illegally nearly three decades ago and became a respected businessman in Hawaii was “inhumane” and “contrary to the values of the country and its legal system.”

In 2012, he wrote an opinion that struck down California’s gay marriage ban. He also wrote a 1996 opinion that struck down a Washington state law that prohibited doctors from prescribing medication to help terminally ill patients die.

“He was a giant -- not just on the 9th Circuit, but within the law,” University of California, Berkeley, law school Dean Erwin Chemerinsky told The Times. “He also was a judge with a particular vision of the law, based on enforcing the Constitution to protect people.”

He was among the federal judges who decided that overcrowding in California’s prison system was unconstitutional.

Reinhardt joined another judge in ruling that the words “under God” in the Pledge of Allegiance were unconstitutional, a decision that was later overturned.

Hector Villagra, executive director of the American Civil Liberties Union of Southern California and a former Reinhardt clerk, called Reinhardt's death "devastating," The Times reported.

He recalled the judge working in his chambers at 11 p.m. on a Saturday writing a dissent to the court’s decision not to rehear a death penalty appeal.

"He knew it was totally pointless," Villagra said. "It wasn't going to affect the outcome. But it was the right thing to do, and that's what mattered. He wanted his voice and his objections heard."

After serving two years in the U.S. Air Force, Reinhardt served as a clerk for a federal judge in the District of Columbia, then entered private practice in Los Angeles. He served on the Los Angeles Police Commission from 1975 until his appointment to the 9th Circuit.

He was born in 1931 in New York. His grandfather fled Nazi Germany, which inspired Reinhardt to “be vigilant in upholding human rights,” The Times reported.

Reinhardt is survived by his wife, Ramona Ripston, the former director of the ACLU of Southern California; three adult children, Mark Reinhardt, 57, a professor of political science at Williams College; Justin Reinhardt, 52, a musician; and Dana Reinhardt, 47, a novelist; and seven grandchildren.

His family has asked that, in lieu of flowers, donations in Reinhardt's memory may be made to the ACLU, BuzzFeed News reported.

His death creates a new vacancy on the 9th Circuit, which President Trump will now be able to fill with his own nominee, the report said.

The Associated Press contributed to this report.