Recent attacks on civilians in the US and Europe have exposed a gap in the intelligence community's efforts to track suspected extremists and prevent mass killings, a half dozen American, British and French counterterrorism officials told Reuters.

The attacks have a common theme of being carried out by actors with an apparent history of mental illness - but few if any direct links to extremist groups, the officials told Reuters.

From both a legal and a strategic perspective, counterterrorism investigators globally are focused on plots by established violent groups with known ideologies, such as Islamic State.

In the US, laws designed to protect citizens from intrusive government spying can limit investigations of individuals unless they have provable ties to foreign terror groups.

Counterterrorism officials told Reuters that the assailants in a recent spate of mass killings all had histories of apparent mental illness . They included the mass shooting at a gay nightclub in Orlando, Florida; the murder of a British parliamentarian in Northern England; the killings of US police in Baton Rouge, Louisiana and Dallas, Texas; the Bastille Day truck attack in Nice, France; and Friday's mass shooting at a German shopping mall.

The counterterrorism officials spoke on condition they and their organisations remained anonymous.

On Saturday, Munich police chief Hubertus Andrae said the Munich gunman, identified in news reports as Ali David Sonboly, had undergone psychiatric treatment before the attack and was obsessed with mass killings. He had no criminal record, and had no known connections to extremist groups.

The German- Iranian 18-year-old, a local resident, shot and killed nine people after opening fire near Olympia shopping mall.

The tactics in such attacks contrast sharply with the attacks in Paris last November and Brussels in March, which were carried out by groups of militants with direct links to Islamic State.

Existing systems for collecting intelligence on extremists are not set up to identify individuals with a history of mental illness who come into contact with people or propaganda that could incite them to engage in violence, the intelligence officials told Reuters.

In the attack in Orlando, the perpetrator had viewed online jihadist propaganda, the investigators said. But subsequent probes turned up no evidence the Orlando shooter, Omar Mateen, had any significant connections with Islamic State or any other militant organisations.