Port State Control (PSC) is a critical inspection mechanism used to regulate and remove substandard foreign ships in national ports, with the aim of ensuring compliance with safety and pollution regulations to prevent threats to the environment. With the heavy and concentrated traffic volumes at ports, executing efficient and effective PSC inspections has become increasingly challenging. This study investigates the risk factors of ship detention and identifies the most critical factor for detention to strengthen maritime safety and environmental protection towards cleaner environment. Using six years dataset with a total inspection of 178,153 from 2010 to 2015, a Bayesian network model was developed to analyze the influencing factors of inspection that lead to detention viz. The flag State, ship type, recognized organization, inspection authority and ship age. The results indicate that the flag State has the greatest influence, followed by ship type, recognized organization, inspection authority and ship age in descending order of importance. These findings guide PSC officers and ship owners in identifying critical areas to enhance maritime safety, promote environmental sustainability and achieve a cleaner environment. A similar approach can be applied to PSC inspection records from other years for further analysis.