"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.
The decision in the socially conservative state comes against the backdrop of similar rulings or actions in states around the country where same-sex couples have long fought for the right to marry. The constitutional ban on same-sex marriage was approved by voters in 2004 and included the out-of-state clause.
The decision came in lawsuits brought by four gay and lesbian couples seeking to force the state to recognize their out-of-state marriages.
The ruling only requires Kentucky to recognize the marriages of gay and lesbian couples performed in other states or countries. It does not deal with the question of whether the state can be required to issue marriage licenses to same-sex couples, as that issue wasn't brought up in the four lawsuits that triggered the ruling.
Heyburn noted that recent U.S. Supreme Court rulings and his opinion in the Kentucky case "suggest a possible result to that question."
With Heyburn's ruling, Kentucky becomes one of 10 states where state or federal courts have reached similar conclusions about same-sex marriage bans.
One of the plaintiffs, 55-year-old Gregory Bourke of Louisville, said the only surprise was the speed with which the ruling came down. The lawsuit was filed in July 2013.
"The word was it could happen any time and I wasn't prepared for it," Bourke said. "It's what we hoped for."
Shannon Fauver, the attorney for the couples seeking recognition, said the ruling applies the constitutional principle that religion cannot be imposed on citizens.
"In theory, same-sex and opposite sex couples should have the same rights," Fauver said. "We're so excited. Legally, I don't think he had a choice. He had to rule in our favor."
The ruling drew the ire of religious leaders who said Heyburn's decision takes away Kentucky's right to determine its policies regarding marriage.
Paul Chitwood, executive director of the Kentucky Baptist Convention, the state's largest religious organization with 750,000 members, called the ruling "tragic and disappointing."
"This decision moves us down the slippery slope toward launching Kentucky into moral chaos and depriving children of their innate need of both a father and a mother," Chitwood said. "I pray the appeals process will honor the Commonwealth's constitution and protect her children."