Dynamics of a toroidal magnetic cloud in the solar wind