We have investigated the metamagnetic-like transition in the triple layer ruthenate Sr4Ru3O10 by means of neutron diffraction from single crystals. The magnetic structure of the compound appears to be determined in a complex way by the two substructures of inequivalent ruthenium ions. At Tc=105K the system has a sharp transition into a ferromagnetic state along the c-axis which is driven by the ruthenium atoms in the central octahedra of the triple layers whereas the substructure of the outer ruthenium atoms tend to align in the ab plane achieving an antiferromagnetic order at the metamagnetic transition T*~50K. Below T* the strong anisotropy along c prevails, the outer ruthenium tend to align along the c-axis and the in-plane antiferromagnetic order disappears. This finding confirms the delicate balance between antiferro and ferromagnetic couplings in the (Sr,Ca)n+1RunO3n+1 family of compounds, and proves the layer dependence of the magnetic anisotropy in Sr4Ru3O10.