How Did Muharram Become The First Month?

How did Muharram become the first month of the Islamic calendar? Should it be the birth or death of Prophet Muhammad (SAW) or the migration?