Magnetars are young neutron stars with very strong magnetic fields of the order of 10(14)-10(15) G. They are detected in our Galaxy either as soft gamma-ray repeaters or anomalous X-ray pulsars. Soft gamma-ray repeaters are a rare type of gamma-ray transient sources that are occasionally detected as bursters in the high-energy sky. No optical counterpart to the gamma-ray flares or the quiescent source has yet been identified. Here we report multi-wavelength observations of a puzzling source, SWIFT J195509+261406. We detected more than 40 flaring episodes in the optical band over a time span of three days, and a faint infrared flare 11 days later, after which the source returned to quiescence. Our radio observations confirm a Galactic nature and establish a lower distance limit of approximately 3.7 kpc. We suggest that SWIFT J195509+261406 could be an isolated magnetar whose bursting activity has been detected at optical wavelengths, and for which the long-term X-ray emission is short-lived. In this case, a new manifestation of magnetar activity has been recorded and we can consider SWIFT J195509+261406 to be a link between the 'persistent' soft gamma-ray repeaters/anomalous X-ray pulsars and dim isolated neutron stars.