A dynamical mechanism is proposed that explains the spiral structure observed frequently as a continuation of the bars in barred spiral galaxies. It is argued that the part of the spirals attached to the bar is due to chaotic orbits. These are chaotic orbits, that exhibit for long time intervals a 4:1-resonance orbital behaviour. They are of the same type of orbits that is responsible for the boxiness of the outer isophotes of the bar in cases like NGC~4314, as indicated by Patsis et al. (1997). The spirals formed this way, are faint with respect to the bar, open as they wind out, and do not extend over an angle larger than $\pi/2$. A possible continuation of the spiral structure towards larger angles can be due to stable orbits at the corotation region. We present a family of stable, precessing short-period banana-like orbits, that can play this role. (P.A. Patsis, "The stellar dynamics of spiral arms in barred spiral galaxies", MNRAS, 2006 - in press)