The Supreme Court ruled Monday in Bostock v. Clayton County that workplace discrimination against LGBT individuals is illegal discrimination on “the basis of sex” under the Civil Rights Act of 1964. The decision was written by Associate Justice Neil M. Gorsuch and won a 6-3 majority. The ruling was hailed by some as a major victory for LGBT rights specifically and for progressive causes more broadly.

Some commentators however were surprised that a ruling that might seem out of step with conservative values was written by a judge appointed by President Trump and was supported by a court where the majority of the justices were appointed by Republican presidents.

Actually, however, the ruling was not as out of step with the values of ordinary Republicans as it first appears. It is hard to know whether judges lead public opinion, or public opinion leads judges, or something else altogether. Still, our research shows there is more support among Republicans for LGBT rights than you might think.

Ordinary Republicans don’t think firms should be allowed discriminate against LGBT workers

In April, we launched SCOTUSPoll, a new yearly national survey of a representative sample of Americans, to find out their attitudes on the major issues facing the Court before it began releasing its opinions in June. Throughout, our goal was to assess whether the Court’s rulings are in step with the views of Americans. For that reason, we used specific but nontechnical language to translate the issues before the Court for the general public.

The first important ruling that we asked about in SCOTUSPoll concerned whether employers could fire gay, lesbian, or transgender workers based on their sexual orientation. The survey showed broad support for LGBT rights, in line with the Supreme Court’s decision.

Specifically, we asked respondents:

“Some people believe that it should be illegal for employees to be fired based on their sexual orientation because it is discrimination on the basis of sex. Other people think that it should be legal because it is not discrimination on the basis of sex. What do you think?”

We found that 83.3 percent of respondents said it should be illegal for employees to be fired based on their sexual orientation. A substantial majority of Republican respondents were against workplace discrimination of LGBT individuals: 73.8 percent of Republicans said the ability to fire employees based on LGBT status should be illegal, compared to 89.5 percent of Democrats and 84.2 percent of independents.

We also asked a similar question about transgender workers. Although the percentages were slightly smaller, the vast majority of Americans also opposed the ability for employers to discriminate against such workers. We found 78.8 percent of Americans thought it should be illegal for employees to be able to be fired for being transgender — 68.8 percent of Republican respondents said it should be illegal, compared to 79.2 percent of independents and 86.2 percent of Democrats.

These results are in line with some other surveys that have been conducted on LGBT rights.

Republican-appointed justices are more conservative than ordinary Republicans

The Court’s opinion in Bostock surprised some observers. After all, the “swing vote” on the Court is currently Chief Justice John G. Roberts Jr., a conservative who was in the losing minority in 2015’s Obergefell v. Hodges decision, which gave same-sex couples the right to marry. Of course, the Court is not designed to be representative of majority public opinion (lifetime appointments are supposed to insulate judges against public or political pressure). Nonetheless, it is interesting to know whether the Court’s rulings are in line with Americans’ views, particularly given that Brett M. Kavanaugh’s appointment to replace Anthony M. Kennedy has pushed the Court to the right.

Our survey tells us the Court’s decision roughly matched public sentiment. However, the Court’s breakdown — with three justices (or 33 percent of the Court) opposed to limiting discrimination against LGBT workers — is more conservative than the general public and more in line with Republican respondents’ views.

Furthermore, when we look only at the Court’s five Republican appointments (Roberts, Gorsuch, Kavanaugh, Clarence Thomas, and Samuel A. Alito Jr.,) and compare them with Republican respondents in our survey, the conservative justices appear out of step. Only 2 out of 5 (40 percent) of these Justices supported LGBT rights in the case — enough for the liberal side to prevail but far fewer than the approximately 70 percent of Republican respondents who supported the LGBT sides in our survey.

We don’t know why judges and the public agree or disagree

The SCOTUSPoll is designed to tell us how well Supreme Court rulings reflect the views of the American public. It doesn’t explain why the rulings do or don’t reflect public views. It could be (as much political science suggests) the Supreme Court is influenced by the views of the public. It could be that the public and the Court independently reach the same conclusions, or that the court decision will push public opinion in an even stronger pro-LGBT direction.

The fact that the Court decision reflected the views of the majority of Americans on this issue does not tell us how it will rule in the future. SCOTUSPoll asked about several other coming decisions, including highly important cases involving immigration, religious freedom, contraceptives, Obamacare, President Trump’s tax returns, the electoral college, abortion rights, and the Consumer Financial Protection Bureau. On most of the issues (LGBT rights, undocumented immigrants, abortion, President Trump’s tax records, the Consumer Financial Protection Bureau, the Affordable Care Act), the survey results show the majority of Americans support the liberal position. However, on the issue of religious freedom (scholarships for religious schools and employer mandates to provide contraception), the majority of Americans support the conservative position. It will be interesting to see how the Court — one of the most conservative in decades — decides to rule on these issues.

Stephen Jessee is an Associate Professor in the Department of Government at the University of Texas at Austin.

Neil Malhotra is the Edith M. Cornell Professor of Political Economy in the Graduate School of Business at Stanford University.

Maya Sen is a Professor of Public Policy at Harvard University’s John F. Kennedy School of Government.