The basis of freedom of religion is found in two principles Bill of Rights which are the Establishment clause and the free exercise clause
The Establishment clause prohibits congress from making a law prohibiting the free exercise of religion. The Free Exercise clause prohibits Congress from making a law respecting an establishment of religion