What exactly was a sheriff in the middle ages during the time of the Robin Hood legends?

by Reactionaryhistorian

In Robin Hood stories the Sheriff of Nottingham is often the big bad who seems to run everything. In contrast a Sheriff today is a (relatively) low level position. But what exactly would have been the position of a Sheriff in England at the time. How would have he been appointed? What was his duties? How important would have he been? Would he be a noble? Would he actually have a castle?

y_sengaku

There will always be more to be said, I posted a brief description on the nature of Anglo-Norman and Angevin sheriffs in the following thread: In the Robin Hood legends, the Sheriff of Nottingham was taxing people into poverty. Could/Would the real Sheriff have done that?