BERLIN (Reuters) - Germany's highest court has approved the extended detention of a 19-year-old Syrian man who was arrested in March for links to the Islamic State militant group, saying he had scouted out key tourist sites in Berlin for potential attacks for months.

In its decision, the Federal Court of Justice said the man, who was not identified by name, could be held for three more months to allow investigators to continue their work, and given the high risk that he could flee the country. It said prosecutors expected to file formal charges soon.

The suspect, who arrived in Germany in August 2015, was believed to have been gathering detailed information for Islamic State until February 2016 about the number of people and tourist buses at Berlin's Alexanderplatz square, the area around the historic Brandenburg Gate and the Reichstag parliament building, according to the ruling.

Germany is on heightened alert after two attacks linked to Islamic State in July.

On Tuesday, police arrested five suspected Islamist militants accused of recruiting fighters for Islamic State in Syria.

In October, Syrian refugee Jaber Albakr was arrested on suspicion of planning a major attack on a Berlin airport. He later committed suicide in prison.

It was not immediately clear if there was any link between Albakr and the Syrian man whose detention was being extended.

The suspect provided details about Berlin tourist sites to an Islamic State contact by telephone in February 2016. He also offered, through electronic messages, to act as a contact for potential attackers in Germany, or carry out an attack himself with two other unidentified people, according to the report, first made public on Thursday.

Investigators examined four mobile telephones and data cards seized during his arrest, and had so far reviewed over 37,000 text messages and chats, nearly 13,000 visual images and over 9,800 video images, according to the court document.

They believe that the man had worked with Islamic State in Syria since 2013, and maintained contact with the jihadist group using his mobile phone after arriving in Germany.

He also planned to return to Syria, where his parents, wife and son still live, to fight in the conflict there, according to the court document.

(Reporting by Sabine Siebold and Andrea Shalal; Editing by Kevin Liffey)