Editor's note: This story has been updated throughout.

Handing gay rights advocates a monumental victory, the U.S. Supreme Court on Friday ruled that marriages between couples of the same sex cannot be prohibited by states, a decision that overrides Texas’ long-standing ban on gay marriage.

In a 5-4 ruling, the high court found that same-sex couples have a constitutional right to marry and that states must license a marriage between two people of the same sex.

"Today’s victory will bring joy to tens of thousands of Texans and their families who have the same dreams for marriage as any others," Chuck Smith, executive director for the gay rights group Equality Texas, said in a statement. "We hope state officials move swiftly to implement the Constitution’s command in the remaining 13 states with marriage discrimination."

Though the Supreme Court ruled specifically on four gay marriage cases out of a Cincinnati-based federal appeals court, its decision legalized gay marriage nationwide, dismaying Texas' Republican leaders.

Texas Gov. Greg Abbott vowed in a statement to defend the religious liberties of those who believe marriage is between one man and one woman. "No Texan is required by the Supreme Court’s decision to act contrary to his or her religious beliefs regarding marriage," Abbott said.

Hours after the Supreme Court ruling, he issued a directive to state agencies: "The government must never pressure a person to abandon or violate his or her sincerely held religious beliefs regarding a topic such as marriage." He said his directive applies to any agency decision, including granting or denying benefits, entering agency contracts or enforcing state laws and regulations.

Texas Attorney General Ken Paxton on Thursday asked county clerks in Texas to hold off on issuing marriage licenses to same-sex couples until further word from him. On Friday morning, he issued a statement that offered no specifics on that, but suggested that the state's next fight will be to defend those who oppose same-sex marriage based on their religious views.

“It is not acceptable that people of faith be exposed to such abuse," Paxton said.

Writing for the majority, Justice Anthony Kennedy wrote that the 14th Amendment requires a state to license a marriage between two people of the same sex, and that the U.S. Constitution does not permit states to bar same-sex couples from marriage.

He wrote that same-sex couples are asking for "equal dignity" in the eyes of the law so they are not excluded "from one of civilization's oldest institutions," and that the Constitution grants them that right.

"It would misunderstand these men and women to say they disrespect the idea of marriage," Kennedy wrote. "Their plea is that they do respect it, respect it so deeply that they seek to find its fulfillment for themselves."

On behalf of the dissenters, Chief Justice John Roberts said the Supreme Court was wrongly intervening in the Democratic process through which state bans were put in place.

"There will be consequences to shutting down the political process on an issue of such profound public significance," Roberts wrote. "Closing debate tends to close minds."

Roberts added that the same-sex marriage bans did not violate the Constitution's Equal Protection Clause because marriage is a state issue. He criticized the majority for "unnecessarily resolving constitutional questions."

"Celebrate the achievement of a desired goal. Celebrate the opportunity for a new expression of commitment to a partner," Roberts wrote. "Celebrate the availability of new benefits. But do not celebrate the Constitution. It had nothing to do with it."

Texas’ ban, which had been on the books for a decade, defined marriage in the state constitution as “solely the union of one man and one woman.” A legal challenge to Texas’ constitutional ban was making its way through the courts.

Two same-sex couples had sued Texas over its gay marriage ban, arguing that it did not grant them equal protection as intended by the 14th Amendment. Attorneys for the state of Texas defended the ban, saying it met equal protection laws and that the courts should not undermine a state’s sovereignty to impose such restrictions.

The Texas case was among dozens of challenges to state same-sex marriage bans that cropped up and barreled through the judicial system after the U.S. Supreme Court struck down part of the federal Defense of Marriage Act in 2013.

The Texas case was among the last to be heard at the appellate level, and it was left pending before the U.S. 5th Circuit Court of Appeals at the time the Supreme Court ruled on the issue.

Texas’ gay marriage ban was believed to be on precarious legal ground as appellate courts across the country made gay marriage legal in almost three-quarters of U.S. states. The Texas ban was also dealt a blow last year when U.S. District Judge Orlando L. Garcia of San Antonio found the state’s ban was unconstitutional because it “violates plaintiffs’ equal protection and due process rights.”

Anticipating an appeal, Garcia stayed his ruling, leaving the ban in place while the state appealed the case to the 5th Circuit. In light of the Supreme Court's ruling on Friday, Garcia lifted his stay to allow his ruling striking down the ban to go into effect.

"The Supreme Court has now made clear that this court was correct, more than 16 months ago, when it held that Texas state law restrictions on same-sex marriage violate the Fourteenth Amendment to the United States Constitution," Garcia wrote.

In a January hearing, a three-judge panel of the New Orleans-based appellate court signaled significant doubt about the constitutionality of Texas’ gay marriage ban, questioning a state attorney's argument that marriage is a “subsidy” the state has the right to grant and withhold.

Days later, the Supreme Court announced it would hear four gay marriage cases out of the 6th Circuit, which last year ruled in favor of same-sex marriage bans in Kentucky, Michigan, Ohio and Tennessee.

Lawyers for Texas and the gay couples suing the state had hoped the appellate court would rule in the Texas case before the high court ruled. On Friday, the gay couples' attorney, Neel Lane, said he still expected a decision from the 5th Circuit "but the outcome is now clear."

The case will now be a "footnote in history rather than a chapter in history," Lane said.

June 26 was already a historic day for gay rights activists. On that same day in 2003, the Supreme Court struck down Texas' sodomy ban, invalidating it and similar laws across the country. A decade later on the same day, the high court struck down key portions of the Defense of Marriage Act, ruling that same-sex couples were entitled to federal benefits if they lived in states that allow same-sex marriage.

On Friday, the plaintiffs in the Texas case gathered in Austin to celebrate the Supreme Court ruling. "It matters that I love him. It's not a trivial thing. It's not something to be brushed aside as if it were nothing," Vic Holmes, one of the plaintiffs in the case, said before proposing to his longtime partner, Mark Phariss.

Though the couple was already planning a November wedding, Phariss accepted.

For the other plaintiffs, Nicole Dimetman and Cleopatra DeLeon, the high court's ruling means their 2009 marriage that took place in Massachusetts will now be recognized in Texas.

"Our kids will never have to grow up feeling like there's an asterisk next to our marriage certificate," DeLeon said. "We are married and Texas has to accept that."