  Precise control over the size and shape of graphene nanostructures allows
engineering spin-polarized edge and topological states, representing a novel
source of non-conventional $\pi$-magnetism with promising applications in
quantum spintronics. A prerequisite for their emergence is the existence of
robust gapped phases, which are difficult to find in extended graphene systems:
only armchair graphene nanoribbons (GNRs) show a band gap that, however, closes
for any other GNR orientation. Here we show that semi-metallic chiral GNRs
(chGNRs) narrowed down to nanometer widths undergoes a topological phase
transition, becoming first topological insulators, and transforming then into
trivial band insulators for the narrowest chGNRs. We fabricated atomically
precise chGNRs of different chirality and size by on surface synthesis using
predesigned molecular precursors. Combining scanning tunnelling microscopy
(STM) measurements and theory simulations, we follow the evolution of
topological properties and bulk band gap depending on the width, length, and
chirality of chGNRs. The first emerging gapped phases are topological,
protected by a chiral interaction pattern between edges. For narrower ribbons,
the symmetry of the interaction pattern changes, and the topological gap closes
and re-opens again as a trivial band insulator. Our findings represent a new
platform for producing topologically protected spin states and demonstrates the
potential of connecting chiral edge and defect structure with band engineering.
