The First Amendment to the U.S. Constitution forbids laws establishing religion or impeding the free exercise of religion. But that doesn’t mean governments in the U.S. – whether federal, state or local – do not place any restrictions on religious activity.

Indeed, according to a recent Pew Research Center study – the sixth annual report in a series – the U.S. has moderate levels of both restrictions on religion and social hostilities toward religious groups, ranking somewhere in the middle range of the nearly 200 countries analyzed in the report.

Among the 25 most populous countries, Egypt, Russia, India, Indonesia and Turkey have the most restrictions on religion, while Japan, Brazil, the Philippines, the Dem. Rep. of the Congo and the U.S. have the fewest restrictions.

Click play to see how restrictions have changed in each country since 2007. Read the full report.

For instance, the U.S. has more extensive restrictions and social hostilities than its northern neighbor, Canada, as well as many other countries in the Americas, according to the 2013 data. But it has a lower level of government restrictions than Mexico as well as some countries in Western Europe, including Italy and Germany.

At the same time, government restrictions on religion in the U.S. are nowhere near as extensive as those of countries such as China, Iran and Burma. Likewise, the U.S. has much lower levels of social hostilities to religion than countries like India, Pakistan and Nigeria.

Many government restrictions in the United States that were taken into account in our analysis originated with state or local governments and were later reversed by courts or by federal agencies.

For example, there were a number of U.S. cases involving local governments denying permission to a religious group to build or expand a house of worship on the basis of land use or zoning laws, only to have those decisions later reversed. In one case, a town in Southern California refused permission to an Islamic center to build a new mosque on its property. A judge later declared the action a violation of federal law. Nevertheless, Pew Research still counts this as an instance of a religious restriction because the decision was implemented before being overturned.

In another more recent incident, a Muslim inmate in a state prison in Arkansas had been prohibited by prison authorities from growing a short beard in accordance with his religious beliefs. But after subsequent litigation, the Supreme Court unanimously ruled that federal law guaranteed the inmate the right to grow his beard.

The other measure used by our study involved religion-related hostilities perpetrated by individuals and groups in society. One particular example gained wide attention in the U.S. in 2013 – the terrorist bombings at the Boston Marathon carried out by two brothers who reportedly were motivated by extremist Islamic beliefs. The bombings killed three people and injured more than 200.

Many other social hostilities involving religion in the U.S. are anti-Semitic or anti-Muslim acts. For example, the Anti-Defamation League reported hundreds of instances of anti-Semitic harassment in the country in 2013. And the FBI reported that, of the 1,163 religiously motivated hate crimes reported in 2013, 14% targeted Muslims.

For more on how Pew Research Center measures religious restrictions and social hostilities toward religious groups around the world, click here.

Peter Henne  is a former research associate who focused on religion research at Pew Research Center.