The man accused of a deadly attack against the Kurdish community in Paris has admitted to a "pathological" hatred of migrants, French prosecutors say.
The 69-year-old told investigators he had planned to kill "non-European foreigners" as he embarked on his shooting spree on Friday, they say.
The suspect was placed in psychiatric care after being questioned by police.
He is accused of opening fire at a Kurdish cultural centre, killing three people and wounding another three.
The man, retired train driver named as William M., told police he had become "depressed" and "suicidal" after his home was burgled in 2016, the office of the Paris prosecutor said.
He admitted since then, his hatred of foreigners had "become totally pathological", the statement said.
It said on the day of the shooting, he first went to Saint-Denis, a high-immigration suburb in northern Paris, in order to kill "non-Europeans" - but found few people there.
He then travelled to the Ahmet-Kaya Kurdish centre in Paris's 10th district, where he carried out the attack.
The man resented that community because Kurdish militiamen involved in the Syrian conflict had "taken prisoners during their fight against Islamic State instead of killing them", the prosecutors say.
A nearby restaurant and a hairdresser also came under fire before the man was arrested without a fight.
He was detained on suspicion of murder, attempted murder, and acting with a racist motive.
He has a history of weapons offences and it has emerged that he was released on bail days before the assault.
Last year, he was charged with racist violence over a sword attack at a migrant camp in the French capital.
The shootings sparked unrest over the past two days. Demonstrators started fires in the streets, smashing car windows and clashing with police.
The violence unfolded after Kurds had gathered peacefully in the Place de la République to pay tribute to the victims.
In the aftermath of the shootings, Kurds have renewed calls to the French authorities for better protection. Community leaders met the Parisian police chief on Saturday.
Kurdish representatives have called for the shooting to be considered a terrorist attack, Reuters reported.
The attack came almost 10 years after the murder of three Kurdish women activists in the French capital - an unresolved crime.
The community was again "afraid", having been "traumatised" by the January 2013 murders, said a lawyer for the Kurdish democratic council in France (CDK-F).
-BBC