What began 20 years ago as a bipartisan drive to protect the rights of people to follow their faith against an overbearing government erupted this week into a divisive dispute over gay rights and religious freedom.

And the fracture can be traced back to two recent moves by the Supreme Court that set up an unusual legal crosscurrent between liberals and conservatives.

By overturning a key provision of the federal Defense of Marriage Act in 2013, the court set in motion a string of rulings across the nation that voided state laws banning same-sex marriage. By this June, a majority of justices is widely expected to legalize gay marriage nationwide.

At the same time, the Supreme Court ruled in another case last year that the family owners of the Hobby Lobby craft-store chain had a religious-liberty right to refuse to offer contraception coverage for its employees.

So while the marriage ruling opened the door for expanded protections for gays and lesbians, the Hobby Lobby decision offered new tools for those opposed to such moves.