This is pretty much an open ended question:
Can anyone tell me something about the origin of nobility and "civil offices" in "semi-civilized" societies? I'm thinking of a social structure where things are still very much contained to the villages which are connected through kinship, but rulership has already become more sophisticated than simply the biggest and meanest warrior forcing his decisions on the community? (I am exagerating, I know.)
I think probably like the very early middle ages, before the Frankish kings and where the athurian legends are based. Or "pre-raiding" Skandinavia.

I think it probably started with community-leaders establishing closer ties and more formal alliances with each other for mutual protection against other communities, and the leaders best buddy being the one who always got entrusted with the same tasks. But I'd like to know some more how things actually did happen but really no clue where to begin with. I imagine written acounts probably being nonexistent, which would make it not particularly popular for sientific research.

If you have some basics you recall, or know about specific sources that deal with these things, I'll be happy with anything anyone can tell me.