In this study, an optimal fractional-order controller is proposed for a type of fractional-order model utilising the direct synthesis method. In that respect, the fractional counterpart of the second-order integer transfer function is selected as a closed-loop reference transfer function. The stability region of the fractional-order closed-loop reference transfer function is given via a theorem and related lemmas. Considering that a unity feedback loop is used, the parameters of the fractional-order closed-loop reference transfer function are specified based on the integral square error performance index within the specified stability region using a genetic algorithm. The time-domain characteristics of the optimal fractional-order closed-loop reference transfer function are compared with those of the optimal second-order integer closed-loop reference transfer function. The fractional- and integer-order controllers that are designed based on optimal closed-loop reference transfer functions are implemented on a real-time system. The performance of the fractional-order controller outperforms that of the integer counterpart on the integral square error criterion. Moreover, the simulation and practical results are consistent with each other.