“How can the Court possibly assert that ‘the First Amendment mandates governmental neutrality between … religion and nonreligion’?” the U.S. Supreme Court Justice Antonin Scalia wrote in 2005, arguing that two Kentucky counties should be able to display the Ten Commandments in their courthouses. “Who says so? Surely not the words of the Constitution.”

This moment, with Scalia’s trademark snark, nicely sums up the paradox of how his religious views influenced his Supreme Court career. The justice, who died Saturday, consistently argued that the United States is fundamentally religious, meaning that the government shouldn’t have to avoid religious displays—nativity scenes on public property, prayers at townhall meetings, and the like. His Roman Catholic faith often seemed to lurk in the background of his opinions, especially in cases involving abortion and homosexuality. But above all, he was committed to a literal, originalist interpretation of the Constitution, along with strict attention to the texts of federal and state laws. His views didn’t always align with those of the Church, and he didn’t always side with people making religious-freedom claims.

Depending on how the nomination and confirmation process unfolds in the coming months, faith could be an important factor in who gets picked to be the next Supreme Court justice. But there won’t be a tidy intellectual spot for this person to fill. Scalia’s legacy on religious and social issues is complicated—in defiance of his reputation as the Court’s most stalwart conservative Catholic.

To be sure, he had this rap for a reason. “The Court has mistaken a Kulturkampf for a fit of spite,” he wrote in his 1996 dissenting opinion to Romer v. Evans, which struck down a Colorado constitutional amendment that prohibited protections for gay people. And “to portray Roe as the statesmanlike ‘settlement’ of a divisive issue, a jurisprudential Peace of Westphalia that is worth preserving, is nothing less than Orwellian,” he wrote in his 1992 dissent in Planned Parenthood v. Casey, in which the Court upheld certain Pennsylvania restrictions on abortion but did not overturn Roe v. Wade. These were cases where “his faith and his jurisprudence coincided,” said Ira Lupu, a professor emeritus at the George Washington School of Law. Even in opinions related social issues like homosexuality or abortion, Lupu said, Scalia’s writing focused on his pet issues of judicial overreach and fidelity to the Constitution. But it had “a nasty edge to it. And this is what gets him quoted.”

In some cases, though, Scalia’s faith and jurisprudence didn't align. Since 1985, the U.S. Conference of Catholic Bishops has publicly opposed the death penalty. Scalia, however, firmly stood against a Court-led abolition of the punishment. In last summer’s case on the use of lethal-injection drugs, Glossip v. Gross, Scalia wrote that Justice Stephen Breyer’s Eighth Amendment argument against the death penalty “is full of internal contradictions and (it must be said) gobbledy-gook.” Consistently, he argued, “the People have voted to exact the death penalty as punishment for the most serious of crimes. Time and again, this Court has upheld that decision.” No matter the Church’s views, moral questions on capital punishment are not to be resolved by the Court, he wrote, but the People.

Looking back through his Supreme Court record, Lupu said, Scalia actually hasn't authored many major 5-4 opinions for the majority—he’s earned his reputation for caustic insults in his dissents. And when he did write the Court’s opinions, it wasn’t necessarily in favor of religious rights. Take for example Employment Division v. Smith, a 1990 case involving two Native Americans who were fired and subsequently denied unemployment benefits after they smoked peyote, an illegal drug, during a religious ceremony. The Court ruled against them, with Scalia arguing that federal judges shouldn’t be in the business of weighing the importance of laws against the significance of people’s religious practice. “The mere possession of religious convictions which contradict the relevant concerns of a political society does not relieve the citizen from the discharge of political responsibilities,” he added.

The backlash was tremendous. As Martha Nussbaum documents, groups ranging from the ACLU to the National Association of Evangelicals protested the decision, seeing it as an impingement on religious freedom, particularly for minority groups. Three years later, Congress passed the Religious Freedom Restoration Act in order to reverse the implications of the Court’s decision in Smith. The new law codified the exact balancing test Scalia had opposed. Though it was later restricted to apply only to federal laws, today, many states are passing their own versions of this law to protect religious groups. Scalia thought it would be a “a parade of horribles” for judges to participate in this kind of balancing act between statutes and beliefs, but once it was written into law, he was fine with it. To wit, nearly two-and-a-half decades after Scalia authored his decision in Smith, he joined the Court’s sweeping Hobby Lobby ruling, which stated that closely held businesses have the right to claim religious exemptions to government regulations on birth-control insurance coverage.

The Court has a number of religious and moral issues on its docket in the next few months. The Little Sisters of the Poor, along with a number of other groups, will challenge the Obama administration’s process for providing exemptions to religious non-profits who want to opt out of insurance coverage for FDA-approved birth control. The Court will look at H.B. 2, a Texas law that places restrictions on where, how, and when women can get an abortion in that state. And it will take upTrinity Luthern v. Pauley, which questions whether a state can deny grant funding for playground restoration to a religious organization specifically because it is religious. While Scalia was on the bench, the Court typically split 5-4 on these kinds of cases, with Justice Anthony Kennedy providing the swing vote in either direction. Without Scalia, Kennedy’s vote would at best produce a split decision, leaving lower-court rulings standing, or combine with the Court’s liberals in a decisive 5-3 majority.

Meanwhile, religious-liberty issues will almost certainly come up in the fight over the next Supreme Court nominee. Ted Cruz has already praised Scalia on this count, calling the justice “an unrelenting defender of religious liberty” on Facebook. Perhaps if Cruz had been running for president in the early ’90s, he would have had a different view. But that’s exactly the point: Scalia doesn’t fit easily into a narrative about American conservatism. He stuck doggedly to legal literalism, whether those interpretations favored his faith or not. He spoke passionately about his belief in the devil and had a fondness for dismissing his colleagues by comparing them to German authoritarians. He did believe that America is a religious country, but above all, he believed it is a country that must be governed by close adherence to what he saw as the original intentions of the Founders, as written in the Constitution.

We want to hear what you think about this article. Submit a letter to the editor or write to letters@theatlantic.com.

Emma Green is a staff writer at ​The Atlantic, where she covers politics, policy, and religion.