When the commissioner of school and public lands shall ascertain that sections sixteen and thirty-six or any part thereof granted to the state have been actually settled upon prior to the survey thereof by the general government, and are occupied by bona fide settlers, claiming title thereto under the homestead laws of the United States, such commissioner is authorized, in its discretion, by and with the approval of the secretary of the interior, or the secretary of agriculture, when necessary, to select from the surveyed, unreserved, and unappropriated public lands of the United States within this state other lands equivalent in area and value, in legal subdivisions, and as contiguous as may be to the section in lieu of which the same is taken.
SDCL 5-3-4