Darwin postulated that their might be both individual natural selection and group selection. With his customary penetration he saw precisely why the notion was problematic and clearly identified the conditions for it to take place. Less careful thinkers ran wild with the idea until the 1966, when George C. Williams wrote Adaptation and Natural Selection: A Critique of Some Current Evolutionary Thought. In it, he used a gene centered approach to demolish almost all ideas of group selection, sending them into a long limbo. He was as clear as Darwin on the exceptional circumstances needed for group selection to actually occur, but apparently didn't think they occurred in nature. Richard Dawkins' The Selfish Gene helped publicize these ideas.
Jonathan Haidt argues that precisely the exceptional circumstances Darwin and Williams foresaw occurred in human evolution, and makes a very strong case. Essentially the mechanism needed is one to punish those who aren't team players. Haidt argues, persuasively I think, that exactly that is the point of many human moral ideas.