(CNN) Judge Stephen Reinhardt, a liberal federal appeals court judge who was part of a panel that rejected California's Proposition 8 same-sex marriage ban as unconstitutional, died Thursday, according to a court spokesperson. He was 87.

Reinhardt, who served on the US 9th Circuit Court of Appeals, died of a heart attack during a visit to his dermatologist, according to spokesman David Madden.

One of the last remaining federal judges appointed by then-President Jimmy Carter, nearly four decades ago, Reinhardt emerged as a staunch critic of the Trump administration's deportation policies and travel ban in the final years of his life.

"We have lost a wonderful colleague and friend. As a judge, he was deeply principled, fiercely passionate about the law and fearless in his decisions," Chief Judge Sidney R. Thomas of the 9th Circuit said in a statement.

"He will be remembered as one of the giants of the federal bench. He had a great life that ended much too soon," Thomas said.