Building temples and mosques where the believers could gather for prayer was an important task for the medieval rulers. It gave the rulers an opportunity to display their wealth, power and devotion to God and proclaim their close relationship to God.