People aren't particularly good. Scourges like say bribery or spousal abuse are rife in much of the world, and commonplace among the populace. In places where they have been nearly eliminated, government has played an enormous role. Not because they catch all the bad guys, but because imposing and enforcing law creates social norms that affect the behavior of ordinary people. Someone in Pakistan isn't more likely to beat his wife than someone in the U.S. because he doesn't understand it's bad or because he isn't worried about getting caught. It's because the relative certainty of enforcement in the U.S. undergirds and sustains a social norm that makes wife beaters into pariahs.[1]
Moreover, murderers and the like aren't the biggest threat to society. What matters are organized groups exercising violence. A small armed group can terrorize a large population, as is demonstrated time and again in places like Pakistan or Iraq. To suppress such groups the government not only has to catch them, but make the retaliation so swift and inevitable that only the irrational would try to bypass the ordinary social and legal structures with force. And the government is very effective at doing this.
[1] This is, incidentally, why there are special laws against e.g. hate crimes, even though assault is already illegal. The generic social norm against assault isn't strong enough to protect a targeted group, and a new law can create a more powerful social norm to compensate.
This phenomenon is also evident in the discrimination context. People didn't just become better and less racist in the last 50 years of their own accord. Laws like the Civil Rights Act catalyzed the change by imposing new social norms. When discriminating in the workplace became illegal, people who discriminated became "bad people" which forced changes in behavior that have little to do with what percentage of people were caught.