Stephen Reinhardt, a liberal-leaning judge on the U.S. Court of Appeals for the 9th Circuit in California, whose rulings overturned bans on same-sex marriage and physician-assisted suicide and declared prison overcrowding unconstitutional, died March 29 in Los Angeles. He was 87.

He had a heart attack while visiting his dermatologist’s office, 9th Circuit spokesman David Madden said.

Judge Reinhardt, considered a liberal icon in legal matters, was an active member of the court, which he joined in 1980 after being nominated by President Jimmy Carter.

As the U.S. Supreme Court grew increasingly conservative after the 1970s, the 9th Circuit, based in San Francisco, remained a liberal outpost in the federal judiciary.

Judge Reinhardt, whose keen legal mind and reasoning were admired even by his ideological adversaries, was a key part of the circuit’s decision-making for more than three decades.

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

Judge Reinhardt was the author of a 1996 opinion that struck down a Washington state law prohibiting doctors from prescribing medication to help terminally ill patients die. In 2012, he wrote a decision ruling that California’s Proposition 8, which amended the state constitution to prohibit same-sex marriages, was unconstitutional.

Notable deaths in 2018 and 2019: Nipsey Hussle, George H.W. Bush, Stan Lee, John McCain, Aretha Franklin and other famous faces we’ve lost

Nipsey Hussle, a Grammy nominated rapper who sought to revive South Los Angeles, died at age 33 on March 31. Read the obituary (Matt Winkelmeyer/Getty Images for Warner Music)

The ban “serves no purpose,” he wrote, “and has no effect, other than to lessen the status and human dignity of gays and lesbians in California, and to officially reclassify their relationships and families as inferior to those of opposite-sex couples.”

Last year, Judge Reinhardt chastised the Trump administration for ordering the deportation of a man who entered the country illegally nearly three decades ago and became a respected businessman in Hawaii, calling the action “inhumane” and “contrary to the values of the country and its legal system.”

Several of the 9th Circuit’s rulings written by Judge Reinhardt were reversed by the Supreme Court, including a 1996 decision nullifying a Washington law prohibiting physician-assisted suicide. Another of his opinions overturned by the Supreme Court was a 2006 ruling that affirmed a lower court’s finding that a law banning “partial-birth” abortions imposed an undue burden on women and was unconstitutionally vague.

In 2002, Judge Reinhardt joined another judge in ruling that the words “under God” in the Pledge of Allegiance were unconstitutional. The decision was later overturned by the 9th Circuit, but not without a noteworthy dissent by Judge Reinhardt, who maintained that the words violated the First Amendment’s establishment clause, forbidding the government from enacting laws favoring one religion over another.

After several of his opinions were reversed by the Supreme Court, Judge Reinhardt was asked by the Los Angeles Times in 1996 if he was angered.

“Not in the slightest,” he said. “If they want to take away rights, that’s their privilege. But I’m not going to help them do it.”

He was born March 27, 1931, in New York as Stephen Shapiro. His name was changed after his mother was divorced and remarried Gottfried Reinhardt, a screenwriter, director and producer whose films include “The Red Badge of Courage.”

He graduated from California’s Pomona College in 1951 and received a law degree from Yale University in 1954. He served in the Air Force before entering private practice in Los Angeles.

Survivors include his wife, Ramona Ripston, the former director of the American Civil Liberties Union of Southern California; three children; and seven grandchildren.

In 1994, Judge Reinhardt wrote a scathing rebuke of President Bill Clinton for not nominating liberal judges to the federal bench, writing in the Los Angeles Times: “Someone must carry on the work of the court’s great progressive thinkers — the justices who ended de jure racial segregation, brought us one man/one vote, opened the courts to the poor and needy, established the right to counsel for all defendants, gave women true legal equality.”