This paper presents a general method for creating an approximately optimal online stabilization system. An optimal stabilization system is an ideal online system that can calculate each optimal motion leading to a stable mechanical goal state depending on the current state. We propose a system that selects each semi-optimal motion according to the current state from a reverse-time tree. To create the reverse-time tree, we applied rapid semi-optimal motion planning method (RASMO) to a reverse-time search from a stable state. We also developed an online motion selection technique. To validate the proposed method, we simulated the stabilization of a double inverted pendulum. When we used an optimization criteria, time optimal, the system quickly stabilized the pendulum's posture and velocity. When we used higher resolution RASMO, the time approached the optimal time. The general framework proposed here is applicable to a variety of machines.