Ultrafast demagnetization after femtosecond laser excitation of thin ferromagnetic films has been shown to occur due to a combination of spin-flip scattering in the film and spin transport to a conducting substrate or adjacent layer. Here we demonstrate that the inherent depth sensitivity of the transversal magneto-optical Kerr effect can be employed to derive conclusions on a transient spatial profile in the magnetization in the direction normal to the sample surface. This magnetization profile is qualitatively different for demagnetization caused by spin flips and spin transport. With the help of simulations based on simple phenomenological models we show that spin transport to the substrate in Co/Cu(001) films dominates the demagnetization before the thermalization of the electronic system, i.e. at times < 100 fs, while after approximately 200 fs mainly spin-flip scattering determines the magnetization profile, in agreement with our earlier findings employing the longitudinal magneto-optical Kerr effect.