At the start of the Tang Dynasty the emperors were tolerant of many religions. Buddhism became a very popular religion throughout China. However, near the end of the dynasty, the rulers made Confucianism the national religion and banned all other religions. Many Buddhist monasteries and temples were shut down.