The resonant Legendre equation