BERLIN — Two men were arrested here Thursday on suspicion of planning a terrorist attack, after the police tracked their purchases of bomb-making materials, a Berlin police spokesman said.

The men, a 24-year-old German of Lebanese descent and a 28-year-old from Gaza, had obtained chemicals that could be used to build explosives, according to the spokesman, Martin Otter, who did not provide any specifics about the chemicals. Mr. Otter said the effort to obtain them was what brought the men to the attention of the police.

The impending 10th anniversary of the attacks of Sept. 11, 2001, has heightened concerns about terrorism in recent days. German officials are also preparing for the arrival of Pope Benedict XVI later in the month.

But the police did not link the arrests to those events. “We have no evidence at this point that it has anything to do with the pope’s visit or Sept. 11,” Mr. Otter said. Neither did investigators say they had reason to believe at this point that the suspects were connected to Al Qaeda or any other terrorist organization.