Britons officially ruled India from 1858 to 1947. They had been there longer from around 1600 when the British East India Company got a charter in 1600.
It's strange how a company could rule a country! But it was fashionable then. The Crown took over from the company in 1857 and ruled the country indirectly through principalities and other pre-existing institutions. Indirect rule was the British ingenious way of running the vast country and other difficult colonies. By not disturbing the existing social order, Britons got more easily accepted. It was also economical.