Greetings and what an important question. I'll give you the research based answer in a concise a way as possible. The bottom line is that parents/primary care givers ultimately have the most influence on their children. One of the very best predictors of a child's self-esteem, school success, and a rewarding life is a secure, open, and loving relationship with his or her parent (also known as attachment). A child with a secure attachment carries the feelings of being loved, respected, and guided by their parent through their entire life-span. When a child (or grown adult) knows they are their parents "sun, moon, and stars," they can draw on this feeling in times of difficulty or stress. Here's a great article explaining attachment:
http://www.education.com/magazine/article/attachment_parenting/
It's important to know that having a secure attachment is not the same thing as permissive parenting, and parents who promote a secure attachment also discipline and use "tough-love" when needed.
The research also shows that a child's peers begin to have a very strong, if not stronger influence than parents beginning around age eight to nine through the teen years. However, as parents we can help our children to make decisions on choosing their friends and peer group (and also moderating the amount of time they are exposed to television and violent video games).
All this being said, research is based on averages, and the individual differences and life experiences can vary considerably among children. Family, school, peer, and media influences are all important.
http://www.education.com/reference/article/peer-group-influence/