  Hume thinks it unnecessary to prove that allegiance to government is the product of convention and not mere nature, since governments are obviously social creations. But he does need to explain the creation of governments and how they solve the problem he describes. He speculates that people who are unaccustomed to subordination in daily life might draw the idea for government from their experience of wars with other societies, when they must appoint a temporary commander. To overcome the preference for immediate gain over long-term security, the people will need to arrange social circumstances so that the conformity to justice is in people’s immediate interest. This cannot be done with respect to all the people, but it can be done for a few. So the people select magistrates (judges, kings, and the like) and so position them (presumably with respect to rank and wealth) that it will be in those magistrates’ immediate interest not only to obey but to enforce the rules of justice throughout society. Hume is vague about the incentives  of the magistrates, but apparently they are so pleased with their own share of wealth and status that they are not tempted by the possessions of others; and since they are “indifferent… to the greatest part of the state,” they have no incentive to assist anyone in any crimes (T3.2.7.6). Thus the magistrates’ most immediate interest lies in preserving their own status and wealth by protecting society. (Perhaps more directly, they stand to lose their favored status if they are found by the people not to enforce the rules of justice.)