When a group is small a powerful leader can hold it together, but as the group grows even the dumbest among them can figure out that if the "peons" band together they can overthrown the leader. This works out fine for small hunter/gatherer type groups.
If the size of the group is to grow some other mechanism MUST be found. Have bad things been done in the name of religions? Of course, but you can say that about just about everything that people have made. So, with that in mind, what mechanism would you think could have held societies together without the bad "side effects"? And what would hold it together now if religion were to go away? Clearly it can't be as simple as everyone just suddenly choosing to be nice to each other and cooperating, because if that worked the world would be a much better place than it is. The only other route that seems even remotely viable is the brutal dictator, which is just an upgraded version of the powerful tribal leader. That approach could work... look at Saddam Hussein, he had a secular government (sorta) and he was very effective at keeping the population in check. But I don't think that's the sort of society you're holding up as a better alternative.
I'm hoping for a really thoughtful answer here, because I think that if you consider this question honestly you may have to re-think your position of religion.
Couldn't law also be the social control mechanism? Couldn't those laws be based on observable reality, science, philosophy, and human psychology among other research-based studies? Wouldn't laws based on those things more closely reflect reality and human understanding of reality instead of arbitrary rules like homosexuality is bad, don't eat pork, eat fish on Fridays, women should stay home and have kids, you can't work on Sundays, etc. etc. etc....? Not that these are all laws now, but they have been and could be in a theocracy.
A lot of religious folks like to point to secular governments (which the US government is supposed to be) like the USSR and China and say "See? That's what atheistic governments do." Well, that isn't true. Those governments weren't humanistic or true communists. Stalinism was what the USSR was following Lenin's death (not that it was communism before that) and what Mao Tse Tung did in China was hardly the result of atheism - it was megalomania that caused the deaths of millions in those cultures, not atheism. Lenin, Stalin, Mao Tse Tung, or any other totalitarian regime would still have committed those atrocities whether they were religious or not. Just look at the Catholic totalitarianism of Spain through the better part of the 20th Century. It had to do with mental illness (like Stalin), or megalomania (like Tung), or simply angry and ruthless overthrow of a priveleged heirarchy (like Lenin), or theocracy (like Iran and Spain). The things that happened then and there weren't the result of atheism, but of a combination of other factors.
Science undermines racism, sexism, homophobia, classism, stereotyping, greed, crimes of the priveleged and wealthy, and ignorance: all things which lead to strife between peoples. Yes, people are imperfect and science won't eradicate evil, but it can help to reduce the evil done by people. I quote I read once, though I can't remember to whom it is attributed loosley reads: A good person will do good things. And evil person will do evil things. But for a good person to do evil things takes religion.
I understand that not all religious people are bad people. In fact, in another thread, I came to better understand why people have faith in their respective religions or spiritual beliefs. That didn't change my mind, however, that religion is personal. It shouldn't be legislated (like teaching creationism in public schools, forcing kids to pray, restricting a woman's right to choose, banning same sex marriage, keeping euthanasia illegal) and it shouldn't be used so that people can justify their actions and seek to dominate or subjugate a group who doesn't hold the same beliefs.
If that were the case now, homosexuals could have same-sex marriages and no one would care! Kids would learn about observable reality in public schools and parents wouldn't feel threatened that their Muslim or Hindu or Buddhist children will be exposed to the teachings of another religion that is sanctioned by the state and therefore made official. Women wouldn't have to be threatened that they might not be able to get an abortion. People who are suffering and dying could die with dignity.
In my opinion, atheists don't believe in an afterlife so they are far less likely to start wars or commit atrocities (except for the insane ones). They are more likely to be tolerant of people's differences (except religion when its forced on others like it is in our nation), and they are more likely to attempt to make the world a better place because its the only place where we can exist. That's just my opinion. But I have faith that atheists tend to be humanistic. And I can't think of any humanist who has done great evil. I can think of many, some that Sky Dancer listed earlier in this thread, who have done great good.
It seems like Christians in this country are attempting to form or transform our government into a theocracy. As an atheist, that scares the shit outta me cause then I might go to jail or be executed for my beliefs. If the government remains secular, then all creeds and religions, all colors and sexual orientations, all kinds of differences can live together fairly harmoniously. That's why Christians think atheists are attacking them. We are reacting to laws that have been passed, are threatening to pass, and could be passed that restrict the rights or liberties of non-believers because those laws are based on the teachings of the Bible and not on scientific research.