Maharaja Ranjit Singh ruled Punjab from the beginning of the nineteenth century till his demise in 1839.