He belonged to the Swedish nobility. The "von Rosenstein" surname was his mother's family name which came through an adoption. His maternal grandfather was Uppsala University professor of medicine Nils Rosén von Rosenstein (1706–1773).[2]