The first Muslim ruler of Kashmir was Shah Mir. Kashmir was a part of the Mughal Empire until it was invaded by Sikhs in 1820.