This is the basis for the John Locke's Idea of Social Contract Theory. According to Locke, citizens would give up some freedom in exchange the government would protect the people from danger. Also part of this is the idea that should the government not do its job properly then the people have the right to overthrow it. This is referred to as the Right to Revolution.