[2] In the early 18th century, Lalji Gandhi moved to Porbandar and entered the service of its ruler, the Rana.
Successive generations of the family served as civil servants in the state administration before Uttamchand, Karamchand's father, became diwan in the early 19th century under the then Rana of Porbandar, Khimojiraj.
Like his father, Ananyachand Gandhi, Karamchand had become a court official, or chief minister, of the local ruling prince of Porbandar.
Karamchand's duties included advising the royal family of Porbandar and hiring other government officials.
Karamchand had very little formal education, but his knowledge and experience made him a good administrator.
The Gandhis had plenty to eat, a respectable number of servants, and a few nice pieces of furniture, but they were by no means wealthy.
His first three marriages ended with the deaths of his wives; among which two died immediately after giving birth to two daughters.