Formation and dynamics of a rotating proton ring in a magnetic mirror