Theory of induced uniaxial anisotropy in magnetic nanostructures