BERLIN (Reuters) - German police arrested a 20-year-old Syrian refugee who sympathized with Islamic State after he tried to cross into Denmark with potential bomb-making materials, a spokesman for the Stuttgart prosecutor's office said on Thursday.

The man, whose name was not disclosed, had been in Germany for some time but it was not immediately clear when he entered the country, the spokesman Jan Holzner told Reuters.

"We have evidence that he sympathized with Islamic State," Holzner said.

He said the man was arrested on Sunday in the southern city of Ulm after failing to cross into Denmark a day earlier, but gave no further details. He did not know whether the man had been granted asylum in Germany.

"He was carrying materials that could be used to make a bomb," Holzner said. He declined to provide any more details but said the quantities of material involved were "not typical of what would be used in a normal household."

He said the investigation was continuing and it was not clear if the man had been in contact with Islamic State members outside of Germany.

"At this point we have no additional suspects in this case. We cannot say if there are others behind the scenes," he said.

German authorities are on high alert for possible Islamist attacks after two attacks linked to the militant group in July.

Holzner said the man would be detained in Stuttgart.

In October, Syrian refugee Jaber Albakr hanged himself after being arrested on suspicion of planning an attack on a Berlin airport.

(Reporting by Andrea Shalal; Editing by Janet Lawrence)