Mode interaction in a spatially inhomogeneous laser