Abstract This study aimed to isolate the antibacterial substance from Mahonia fortunei and determine its antibacterial activity against Xanthomonas oryzae pv. oryzicola ( Xoc ). Bacterial leaf streak of rice, caused by Xoc , is an important rice disease and difficult to control. During a screening of antibacterial plants against plant pathogenic bacteria at an early stage, the extract from M . fortunei was found to have a strong inhibitory effect on Xoc . In this study, the chemical components of M. fortunei stems were extracted using methanol solvent, the antibacterial substance was isolated and purified by liquid–liquid partition and silica gel column chromatography and its structure was identified by nuclear magnetic resonance. The effect and mode of action of the antibacterial substance on bacterial leaf streak of rice were also detected under greenhouse conditions. Two compounds were identified, berberine and jatrorrhizine, which had a strong inhibitory effect on Xoc . The antibacterial activity of berberine was stronger, with a half‐maximal inhibitory concentration ( IC 50 ) of 2.9008 mg/l. At the concentration of 0.5 g/l, its control efficacy on bacterial leaf streak of rice was more than 84%. Additionally, berberine could be absorbed by rice leaves and be translocated up and down in the rice plant, and the effective period was long, but its capability of lateral translocation inside the blade was poor.