After the Supreme Court legalized same-sex marriage in all 50 states, a hardware store in Grainger County, Tennessee, put up a sign with a terrible message: "No gays allowed." And while this might seem abhorrent to most people, it turns out that it's totally legal.

Jeff Amyx, a baptist minister who owns Amyx Hardware & Roofing Supplies, told WBIR 10 News that he put up the sign because he's religiously opposed to gay and lesbian couples, and that he has no intent of taking the sign down.

The storeowner's actions invoke memories of similar signs that were used in the South prior to the Civil Rights Movement to enforce segregation, which is now illegal under federal law. But unlike discrimination against black people and other racial minorities, this type of discrimination against gay and lesbian people is totally legal — not just in Tennessee, but most other states in the US.

31 states don't ban discrimination against sexual orientation or gender identity

Thirty-one states lack civil rights laws that would ban discrimination based on sexual orientation or gender identity in the workplace, housing, or public accommodations (hotels, stores, and other places that serve the general public).

As a result, more than half of LGBTQ Americans, according to the LGBTQ advocacy group Movement Advancement Project, live in a state where, under state law, an employer can legally fire someone because he's gay, a landlord can legally evict someone because she's lesbian, and a hotel manager can legally deny service to someone who's transgender — for no reason other than the person's sexual orientation or gender identity.

Currently, 19 states ban discrimination based on sexual orientation and gender identity, while three additional states ban discrimination based on sexual orientation. Some other states protect public but not private employees from discrimination. Many municipalities have nondiscrimination laws that only apply within their local borders, even in states that don't have such laws. And some companies prohibit discrimination in their own policies.

The protections can further vary from state to state. Massachusetts's protections for gender identity and Utah's protections for sexual orientation and gender identity don't apply to public accommodations. Some states also include exemptions for discrimination based on religious grounds. Enforcement varies, as well: Depending on the state, private lawsuits, fines, and jail time are all possible forms of punishment for discrimination.

These nondiscrimination protections build on existing federal and state laws — most notably the Civil Rights Act of 1964 and Fair Housing Act, which protect people from discrimination based on their race, color, national origin, religion, and sex. (Some LGBTQ advocates argue that legal prohibitions against sex discrimination already protect LGBTQ people. But that interpretation hasn't been affirmed by higher courts, casting uncertainty over whether it would hold up in legal disputes.)

Most Americans think anti-LGBTQ discrimination is already illegal

Surveys show that most Americans widely support nondiscrimination protections, but a major hurdle to getting the laws passed may be that Americans already think they're in place.

In a 2014 poll from YouGov and the Huffington Post, 62 percent of respondents said it was already illegal under federal law to fire someone for being gay or lesbian, 14 percent said it was legal, and 25 percent weren't sure. The same poll found most Americans — 76 percent — said it should be illegal to fire someone for being gay or lesbian, while just 12 percent said it should be legal.

"it can be difficult to work up the motivation that's necessary to push for them"

The YouGov and Huffington Post poll isn't the first to find strong support for civil rights protections for LGBTQ people. Another 2014 survey commissioned by HRC, an LGBTQ advocacy group, found 63 percent of US voters favored a federal law that protects LGBTQ people from employment discrimination, while just 25 percent opposed it.

For LGBTQ advocates, the overall results present a tricky situation: Most Americans support nondiscrimination protections for LGBTQ people, but they don't appear to know that these protections aren't already law.

"When people already think these protections are in place, it can be difficult to work up the motivation that's necessary to push for them," Ian Thompson, LGBTQ legislative director at the American Civil Liberties Union, said in April.

So in the case of Amyx Hardware & Roofing Supplies, the owner's actions are totally legal — even if most Americans think they're not and shouldn't be.