"Woe to the wicked who does evil, for the recompense of his hands shall be done to him." (Yishiyahu 3:11)
The gemara (Kiddushin 40a) notes a redundancy in this verse. "Is there a righteous man who is good and a righteous man who is no good? Rather, one who is good to Heaven and also to his fellow man is a good righteous man. One who is good to Heaven but not to his fellow man is a righteous man who is not good. 'Woe to th evil wicked man' Now, is there an evil wicked man and a wicked man who is not evil? Rather, one who is evil both to Heaven and to his fellow man is an evil wicked man, while one who is evil to Heaven but not to his fellow man is a wicked man who is not evil.
Now, this concept is not exactly a novel one in Jewish thought. We know very clearly that there are two categories of mitzvos, between man and man and between man and God. The verse in Yishiyahu, as understood by Chazal, note that one can apply specific labels to one is observant of both, either or neither of these two categories.
Thus one can be completely ignorant of one's obligations to Heaven or, chas v'shalom, aware of them and simply not interested in performing those duties but as long as this person treats his fellow human being with decency and honesty, he is still "good" even if he lacks what it takes to be called "righteous". Similarly, the guy in the black hat who makes sure he shockles with all the fervor in the world while cheating the local business he works for also has a measure of righteousness for he is careful to relate properly to God even as he neglects his responsibilities to society.
Or is that really so?
Take a look back at the two principle stories in Noach, that of the generation of the Mabul and that of the generation of the Tower of Bavel. The former are never explicitly labelled as idol worshippers in the text, the latter on the other hand try to start a war with God. The former live lives of compelte anarchy in a society rife with theft and murder. The latter live in harmony with one another even in the absence of God's visible presence or a hint of his Torah. And who gets sentences to total destruction? The generation of the Mabul.
Why? Chazal drive this lesson home clearly. God is prepared to tolerate a godless society in which there is rule of law. He cannot tolerate a society that acknowledges him but in which people treat each other improperly.
But if both categories of mitzvos are equally important, and we believe that they are, then why should this be so? The generation of the Tower of Bavel should have been just as likely to be wiped out because of their revolt against God.
From the fact that they weren't even criticized openly by God, we can learn an important lesson. The reason is that in a proper society fear and knowledge of God can eventually arise that is pure and true. In an anarchy, even if people run around claiming obescience to the Ribono shel Olam, there is no chance of this happening because even those who take the time to worship God will ultimately do so with resources they have acquired through sinning against their fellow.
In other words, you cannot truly perform ben adam l'makom until you have mastered ben adam l'chaveiro. The best Jew is exceptional in his performance of both these categories but the latter clearly serves as the foundation for God fearing behaviour. You must be good and from there you can learn to be righteous.