Complex gamma-ray behavior of the radio galaxy M 87