The 6-3 ruling overturned the court's decision 17 years ago that states could punish homosexuals for what was historically considered deviant sex.
The issue of states rights is a particularly touchy one when it comes to legal matters, and state authorities often argue that federal laws should not supercede their own.
As recently as 1960, every state had an anti-sodomy law. Since then, the statutes have been repealed by lawmakers or blocked by state courts in 37 states.
Of the 13 states with sodomy laws, four -- Texas, Kansas, Oklahoma and Missouri -- prohibit oral and anal sex between same-sex couples. The other nine -- Alabama, Florida, Idaho, Louisiana, Mississippi, North Carolina, South Carolina, Utah and Virginia -- ban consensual sodomy for everyone.
Though seldom enforced by police, the state anti-sodomy laws are sometimes invoked by judges to deny homosexuals legal custody of their children, equal employment guarantees (search) and other civil rights.
"As of two hours ago, they are all invalidated," Fox News senior judicial analyst Andrew Napolitano said after the Supreme Court's ruling Thursday.
But "the practical effect of that is next to nothing," he said, because most states don't enforce their anti-sodomy laws. "They're practically unenforceable," Napolitano said, adding that police can't just barge into people's homes to find out if they're having illegal sex.
Thursday's Supreme Court ruling reversed a 1986 decision upholding state anti-sodomy laws similar to Texas'. Many legal briefs filed in support of the two men in the Texas case argued that times have changed since 1986, and that the court should catch up.
"That's almost one of the reasons the court invalidated the statute -- because Texas itself didn't enforce it within the past 10 years with the exception of this one case," Napolitano said.
At the time of the court's 1986 ruling, 24 states criminalized such behavior. States that have since repealed the laws include Georgia, where the 1986 case -- Bowers v. Hardwick -- arose.
Of the nine justices who ruled on the 1986 case, only three remain on the court. Chief Justice William H. Rehnquist and Justice Sandra Day O'Connor sided with the majority in that case, and Justice John Paul Stevens dissented.
"Bowers was not correct when it was decided, and it is not correct today," Justice Anthony M. Kennedy wrote for the majority Thursday.
Although laws forbidding homosexual sex were once universal, those on the books now are rarely enforced but underpin other kinds of discrimination, lawyers for the two Texas men whom the case centered around argued in court.
"Law enforcement, our lawmakers, have better things to do" than police people's bedrooms, criminal defense attorney Daniel Perez told Fox News.
"People doing things behind closed doors, states can stay out of it," agreed former prosecutor Michael Worthy.
The Texas case began when a neighbor with a grudge against John Geddes Lawrence and Tyron Garner faked a distress call to police, telling them that a man was "going crazy" in Lawrence's apartment. Police went to the apartment and found the two men having anal sex. They were each fined $200 and spent a night in jail for the misdemeanor sex charge in 1998.
Dale Carpenter, a law professor at the University of Minnesota, said the court's decision "did signal it was sympathetic to the equal protection argument" of the 14th Amendment.
The home "is a sacred place in American law and in constitutional law, and that is the principle that was vindicated in this ruling today," Carpenter said.
Attorneys for Texas defended the sodomy law, saying it was in keeping with the state's interest in protecting marriage and child rearing. Gay sex, the state argued, "has nothing to do with marriage or conception or parenthood and it is not on a par with these sacred choices."
The state had urged the court to draw a constitutional line "at the threshold of the marital bedroom."
But Texas lost its argument in the end.
"Liberty protects the person from unwarranted government intrusions into a dwelling or other private places. In our tradition the state is not omnipresent in the home," Kennedy wrote.
"The state cannot demean their existence or control their destiny by making their private sexual conduct a crime … adults may choose to enter upon this relationship in the confines of their homes and their own private lives and still retain their dignity as free persons."
Justices Stevens, David Souter, Ruth Bader Ginsburg and Stephen Breyer agreed with Kennedy in full. O'Connor agreed with the outcome of the case but not all of Kennedy's rationale.
Rehnquist and Justices Antonin Scalia and Clarence Thomas dissented.
Napolitano said he disagreed with Scalia's decision, but he defended the justice's rationale.
"This is not the first time he has made this argument," Napolitano said.
Scalia was arguing that "it is a states right issue," Napolitano said. "He may not have voted for this law … but he believes the people of Texas should be able to establish their own laws, not the nine unelected justices in Washington, D.C."
But Napolitano added his own opinion: "It's not a state's issue, it's a privacy issue."
Although the majority opinion said the Texas case didn't "involve whether the government must give formal recognition to any relationship that homosexual persons seek to enter," Scalia said the ruling invites laws allowing gay marriage.
"This reasoning leaves on shaky, pretty shaky grounds, state laws limiting marriage to opposite-sex couples," Scalia wrote.
Thomas wrote separately to say that while he considers the Texas law at issue "uncommonly silly," he couldn't find any general right to privacy in the Constitution.
Fox News' Liza Porteus and The Associated Press contributed to this report.