BERLIN -- A German soldier who had posed as a Syrian refugee was arrested on suspicion he was planning an attack, apparently motivated by anti-foreigner sentiment, in a case that prosecutors said Thursday was "more than strange."

The 28-year-old lieutenant, whose name wasn't released, faces charges of preparing an act of violence, said Frankfurt prosecutor's spokeswoman Nadja Niesen.

The officer, who was "of German background" and stationed in France, allegedly stashed a loaded pistol in a bathroom at the Vienna airport that was discovered, leading Austrian authorities to take him into temporary custody when he went to retrieve it in February, Niesen said.

Get Breaking News Delivered to Your Inbox

Though under investigation in Austria, authorities there did not keep him in custody and he was arrested in southern Germany on Wednesday.

A 24-year-old student from the soldier's hometown of Offenbach was also arrested.

"We know from various voice recordings that both had anti-foreigner views," Niesen said.

The officer had registered as a Syrian refugee in the state of Hesse at the end of 2015 and had been living "sporadically" at a home for asylum seekers since January 2016. Though he was officially stationed with the Bundeswehr in France, authorities say he wasn't required to be present at all times.

Prosecutors believe the officer may have intended to orchestrate an attack so that it was blamed on foreigners, though they haven't yet found evidence to support the theory, Niesen said. Refugees have carried out several deadly attacks in Germany over the past year, stoking anti-migrant sentiment in the country.

"It sounds more than strange," Niesen told reporters. "I think we have to await more from the investigation to find out more about his motivation."

Sixteen buildings were searched in Germany, Austria and France in connection with the investigation, and multiple mobile telephones and other electronic devices were seized as evidence, Niesen said.

Niesen said the suspect knows no Arabic and she did not know how he managed to pass himself off as a Syrian refugee.

"This is quite an unusual story," she said.