In the quest for new energy sources, the research on controlled thermonuclear fusion has been boosted by the start of the construction phase of the International Thermonuclear Experimental Reactor (ITER). ITER is based on the tokamak magnetic configuration, which is the best performing one in terms of energy confinement. Alternative concepts are however actively researched, which in the long term could be considered for a second generation of reactors. Here, we show results concerning one of these configurations, the reversed-field pinch (RFP). By increasing the plasma current, a spontaneous transition to a helical equilibrium occurs, with a change of magnetic topology. Partially conserved magnetic flux surfaces emerge within residual magne...