Significance of thin layers of ferromagnetic semiconductors (Ga,Mn)As for applications in spintronics is based on their magnetocrystalline anisotropy. While the orientation of an easy magnetic axis along the layer plane and its change to normal direction in case of Bravais lattice deformation is well understood, the origin of surface uniaxial anisotropy, that means non-equivalence of  and [¯110] directions, has not been resolved yet. In this work we explained possible microscopical mechanism of this effect. We report on high-resolution x-ray diffraction measurements of (Ga,Mn)As and (Ga,Mn)(As,P) epilayers. We observed a structural anisotropy in the form of stacking faults that are present in the (111) and (111¯) planes and absent in the (1¯11) and (11¯1) planes. They occupy 10−2%–10−1% of the ferromagnetic epilayer volume while no stacking faults are detected in the controlled, undoped GaAs epilayer. Full-potential density functional calculations provide additional evidence that the formation of the stacking faults is promoted by Mn attracted to these structural defects. The enhanced Mn density along the common [11¯0] direction of the stacking fault planes produces a symmetry-breaking mechanism of a strength and sense that can account for the uniaxial /[11¯0] magnetocrystalline anisotropy of these ferromagnetic semiconductors.