Understanding whether laws shape or simply reflect citizens' attitudes is important but empirically difficult. We provide new evidence on this question by studying the relationship between legal same-sex relationship recognition policies (SSRRPs) and attitudes toward sexual minorities in Europe. Using data from the European Social Surveys covering 2002- 2016 and exploiting variation in the timing of SSRRPs across countries, we show that legal relationship recognition is associated with statistically significant improvements in attitudes toward sexual minorities. These effects are widespread across demographic groups, emerge only after the policies are adopted, and are not observed for views on other social issues. Our results suggest that laws can exert a powerful influence in shaping societal attitudes.