(CNN) A Virginia restaurant's decision not to serve White House press secretary Sarah Sanders raises a major question: Can businesses serving the public legally do that?
The answer is not clear cut. It depends on a number of factors, including whether the business's reasons are political, moral or discriminatory, and the person claiming discrimination falls under a protected trait or class, such as race or religion, lawyers say.
With specific federal law and state laws that vary to certain degrees, it also depends on where the incident happened.
Let's look at some scenarios:
What the law says:
Under American law, a business owner has the right to refuse service to some customers. But federal and a lot of state laws say you can't discriminate against customers based on factors such as race, religion, sex or national origin, said Alexandra Brodsky, a civil rights attorney at the National Women's Law Center.
Turning away Sanders because she's President Trump's press secretary gives the impression that public spaces and public businesses are not open to all, says David Cole, legal director at the American Civil Liberties Union. However, he notes, a business being uncivil or rude isn't illegal.
In the District of Columbia, there's a list of 20 protected traits that include race, religion, disability and political affiliation.
If Sanders was refused service in DC, and it was considered a result of her political affiliation, that would have been illegal in the nation's capital. Virginia has a similar list, but it doesn't include political affiliation.
What the law says:
Arizona is one of six states with a law allowing pharmacists to decline to sell emergency contraceptives on "moral grounds," according to the National Conference of State Legislatures. The other five states are Arkansas, Georgia, Idaho, Mississippi and South Dakota.
Kansas has a similar law that allows pharmacists to refuse to fill a prescription if he or she "reasonably believes" the medicine could result in an abortion.
Colorado, Florida, Illinois, Maine and Tennessee have similar refusal clauses that do not specifically mention pharmacists.
Walgreens says its pharmacists can step away from filling a prescription if the decision is based on a "moral objection." When a pharmacist opts to do that, he or she must refer the prescription to another pharmacist or manager on duty.
Walgreens has since apologized to the woman, and said it will provide additional training to its staff.
What the law says:
Like other states, Colorado prohibits businesses open to the public from denying people service based on characteristics such as religion, race and sexual orientation.
However, under the federal Civil Rights Act of 1964, discrimination in public businesses in the United States is prohibited on the basis of race, color, religion or national origin -- but it does not include specific sexual orientation or gender identity protections.
When there's a conflict between federal and state laws, federal law always trumps state law. But federal law does not conflict with a state law merely because it covers fewer protected classes, Brodsky said
In this case, the Supreme Court ruled in Phillips' favor and said the state commission treated him with hostility by downplaying his religious liberty concerns. However, the ruling did not address a broader constitutional question on religious liberty.
Brian Powell, a sociology professor at Indiana University Bloomington, says you cannot compare this case to Sanders' incident because sexual orientation is a protected status in some states while political viewpoints are not.
What the law says:
A US District Court judge declared Davis in contempt of court for refusing to issue the licenses and not allowing her deputy clerks to give them on her behalf. The couple at the center of the lawsuit eventually got a marriage license that said "pursuant to federal court order" on it. Instead of listing Davis' name, it had the city of Morehead, the county seat.
What the law says:
Like many other states, New York has a public accommodation law that makes it illegal to discriminate against people for a list of reasons, including religion, marital status, age, disability, gender identity and race. Political affiliation and what you're wearing are not on the list.
Legal experts say business owners are at liberty to enforce dress codes -- as long as they don't fall under discrimination categories.
We've all seen the "no shirt, no shoes, no service" signs, essentially saying the business owner can deny service based on your outfit. Such policies are rarely illegal because they don't discriminate against any particular category, experts say.
A large number of Americans believe private businesses should be able to deny service to anyone, according to research by Powell, the sociology professor.
"When they focus on the word private, they're thinking businesses are individually owned. A large number of people don't recognize that these businesses are dealing with public accommodations -- and you're serving the public. That's one thing they don't take into account," Powell says.
They may be private businesses but if they serve the public, they're not exempt from following the law.