How does the concept of contempt of court protect the independence of the judiciary in India?

I want to understand why contempt of court is considered important and how it ensures that the judiciary remains independent and respected in the country.