Abstract : This paper addresses the forbidden state problem of Petri nets with liveness requirement and uncontrollable transitions. The proposed approach synthesizes in two steps an optimal Petri net-based controller, whenever such a controller exists. First, the behavior of the closed loop system is computed with a Ramadge-Wonham-like approach. Then, control places, that realize the computed behavior when added to the original model, are synthesized. Necessary and sufficient condition of the existence of such places is obtained. A manufacturing application of the method shows its efficiency.