Two setups with interlocked magnetic flux tubes are used to study the evolution of magnetic energy and helicity on magnetohydrodynamical (MHD) systems like plasmas. In one setup the initial helicity is zero while in the other it is finite. To see if it is the actual linking or merely the helicity content that influences the dynamics of the system we also consider a setup with unlinked field lines as well as a field configuration in the shape of a trefoil knot. For helical systems the decay of magnetic energy is slowed down by the helicity which decays slowly. It turns out that it is the helicity content, rather than the actual linking, that is significant for the dynamics.