The drylands of China are extensive, and they are home to more than one-third of the country's population. However, the watershed territories of the drylands, where the majority of human activities are concentrated have long experienced strained human-land relationships, culminating in ecological security concerns. Correspondingly, it is essential to carry out a comprehensive assessment of the ecological security of dryland watersheds and to identify the key factors influencing ecological security in order to formulate strategies that ensure the sustainability of drylands. Premised on the Driving-Pressure-State-Impact-Response (DPSIR) model, this study developed an ecological security index and applied it to the Irtysh River Basin of Xinjiang, China, from 2000 to 2020. The obstacle degree model was applied to reveal the obstacles in two dimensions: criterion level and indicator level. The findings suggested that the ecological security comprehensive index in the Irtysh River Basin has increased significantly from 2000 to 2020, irrespective of the fact that it decreased during the study period and then increased. The ecological security level changed from 'critically safe' in 2000 to 'general safety' in 2020, with the state subsystem and pressure subsystem becoming ecological security weaknesses. The primary factors influencing the ecological security of the study area were water consumption, the area of high-efficiency water-saving irrigation, the proportion of wetland area, vegetation coverage, and livestock population. The ecological security of different counties in the basin varies greatly, whereas the factors that influence ecological security showed both similarities and differences among the counties. In light of on the findings, we proposed that future strategies for ecological security enhancement should concentrate on enacting the policy of localizing spatial differentiation, optimizing industrial structure, strengthening scientific and technological support in the field of water conservation, bolstering the treatment capacity of environmental facilities, and implementing the Mountains-Rivers-Forests-Farmlands-Lakes-Grasslands System to support the sustainable development of dryland watersheds.