Judge Stephen Reinhardt of the 9th Circuit Court of Appeals died Thursday at 87 years old, the court said.

Reinhardt was appointed to the 9th Circuit by former President Jimmy Carter in 1979 and was once deemed the “liberal lion” of the court. The appeals court said Reinhardt died of a heart attack while at the dermatologist.

“All of us here at the 9th Circuit are shocked and deeply saddened by Judge Reinhardt’s death,” 9th Circuit Chief Judge Sidney Thomas said in a statement. “We have lost a great friend and colleague. As a judge, he was deeply principled, fiercely passionate about his law and fearless in his decisions. He will be remembered as one of the giants of the federal bench.”

Reinhardt was the sixth longest-serving judge on the court and wrote several opinions on hot-button issues including gay marriage and immigration.

Last year, Reinhardt authored an opinion calling the Trump administration’s order to deport Andres Magana Ortiz, who came to the U.S. illegally nearly 30 years ago and became a businessman in Hawaii, “inhumane” and “contrary to the values of the country and its legal system.”

“President Trump has claimed that his immigration policies would target the ‘bad hombres,’ ” Reinhardt wrote. “The government’s decision to remove Magana Ortiz shows that even the ‘good hombres’ are not safe.”

He criticized Trump again last year in an opinion after the 9th Circuit decided not to rehear a case challenging the president’s travel ban.

“I am proud to be a part of this court and a judicial system that is independent and courageous and that vigorously protects the constitutional rights of all, regardless of the source of any efforts to weaken or diminish them,” Reinhardt wrote.

Reinhardt was also part of the three-judge panel that struck down California’s Proposition 8, the voter-approved measure banning gay marriage, in 2012.

The panel ruled that Proposition 8 “works a meaningful harm to gays and lesbians” and was a violation of the 14th Amendment.

Reinhardt’s death creates a vacancy on the 9th Circuit that Trump will now get to fill with his own nominee.

The president has frequently slammed the San Francisco-based court, which has ruled against a number of key items on his agenda, including his travel ban and sanctuary cities policies.

Trump told the Washington Examiner last year he has “absolutely” considered plans to split up the 9th Circuit.

The appeals court covers Alaska, Arizona, California, Guam, Hawaii, Idaho, Montana, Nevada, the Northern Mariana Islands, Oregon, and Washington.