This paper deals with the nonlinear control strategy to stabilize a rotating flywheel pendulum (RFP) at the unstable upper position. For that purpose a switched swing-up and stabilization control is proposed. A nonlinear model of the RFP is derived allowing for a computer simulation of its behavior in the full state space. Based on this model, a nonlinear energy based swing-up controller is combined with a local linear stabilization controller allowing for transferring the pendulum from its stable rest position to the upward unstable position, stabilizing it and compensating a wide range of disturbances. Simulation results show a good performance of the proposed control scheme.