This study presents an integrated model of maintenance and statistical process control (SPC) for a production process with three states (in-control, out-of-control, and failure). The process is operational in both in-control and out-of-control states. However, the quality of the process's output deteriorates in an out-of-control state, and the process completely stops in the failure state. If the process enters the out-of-control state and no maintenance action is performed, it eventually enters the failure state. While the failure state is observable, judgment is made about the operational states of the process, i.e., in-control and out-of-control states, based on the quality of the produced items using a control chart. When the process shifts to an out-of-control state, and the control chart identifies this transition, minor repair applies, restoring the process to an in-control state, and continuing the production cycle. However, at most minor repairs can be conducted during a production cycle. When the process moves to a failure state, the production cycle terminates, and a major repair is conducted. It is assumed after performing each minor repair, the life of the production machine decreases stochastically. In the paper, a mathematical model is developed to determine the optimal sample size, sampling interval, the limits of the control chart, and the maximum number of minor repairs during a process cycle. The model is developed without restrictive assumptions about (1) process failure mechanism (PFM), (2) stochastic process representing the imperfect effect of maintenance, and (3) control charts employed to monitor the process. Hence, from three aspects, the proposed model has a general structure leading to widespread applicability of the model for different working conditions. As a special case, we demonstrated the application of the model considering a Weibull distribution to represent the PFM, a stochastic geometric process (GP) to describe the imperfect ef