BERLIN: A German soldier who pretended to be a Syrian refugee has been arrested on suspicion he planned a gun attack with racist motives, prosecutors said Thursday.

The 28-year-old suspect who was not identified was thought to have a “xenophobic background”, they said — while Die Welt daily reported he may have plotted to pin the blame for an attack on foreigners.

The strange case involved a joint police operation across Germany, France and Austria with raids on 16 locations, prosecutors in Frankfurt said in a statement.

They arrested the soldier — a lieutenant usually stationed on a Franco-German military base near Strasbourg — in the southern German city of Hammelburg on Wednesday.

On the same day they also arrested a second German man, a 24-year-old student and alleged co-conspirator in possession of objects that breach weapons and explosives laws, they said.

The lieutenant had been temporarily detained by Austrian police on February 3 at Vienna airport when he tried to retrieve a loaded, unregistered handgun he had days earlier hidden in a toilet there.

This sparked an investigation that threw up an even bigger surprise: the suspect had in December 2015 created a false identity as a Syrian refugee.

He had registered himself at a refugee shelter in the central German state of Hesse and later even launched a request for political asylum in Bavaria state, said the prosecution statement.

Die Welt reported that the request was accepted, even though the man speaks no Arabic.

He was allotted a place in the refugee home and has since January 2016 received monthly financial payments under this false identity, the prosecutors said.

“These findings, and indications of a xenophobic background of the Bundeswehr soldier, suggest that the accused was planning a serious crime endangering state security with the weapon that was earlier deposited at Vienna airport,” said the statement.

Security services in the sweeping cross-border raids targeting contacts of the two men confiscated mobile phones, laptops and written materials, said the statement.