LOUISVILLE, Ky. (AP) — A federal judge whose ruling striking down Kentucky's ban on gay marriage led to an appeal heard this week in the U.S. Supreme Court died Wednesday. He was 66.

U.S. District Judge John G. Heyburn II died at home in Louisville surrounded by family after battling cancer for several years, the U.S. District Court for the Western District of Kentucky announced.

"John Heyburn untangled countless legal knots and delivered sweeping legal opinions on cases of incredible complexity over his more than two decades on the federal bench," U.S. Senate Majority Leader Mitch McConnell said in a statement.

Last year, Heyburn struck down Kentucky's ban on gay marriage and on recognizing same-sex marriages from outside the state. The rulings were reversed on appeal, but the Supreme Court heard arguments on them Tuesday.

Heyburn wrote that the ban on marriages performed elsewhere treated "gay and lesbian persons differently in a way that demeans them."

"Assigning a religious or traditional rationale for a law does not make it constitutional when that law discriminates against a class of people without other reasons," wrote Heyburn, an appointee of President George H.W. Bush.

"John had a gifted legal mind, but he also had the ability to see beyond the legal arguments and into the humanity of those who came before him," Senior Judge Charles R. Simpson III said in the statement from the court.

Heyburn graduated with a degree in history from Harvard, served in the Army Reserves from 1970 to 1976 and graduated from the University of Kentucky law school in 1976.

He is survived by his wife, Martha, and two sons.