BARCELONA, Spain -- A man pleaded to be let into a locked police station in Barcelona before dawn Monday, then lunged with a knife at officers inside. Police shot him dead and the attack is being investigated for any links to terror, authorities said.

Commissioner Rafel Comes, the second-in-command of the Catalan regional police, told reporters that police are treating it as a terrorist attack "for the moment" because the incident was "extremely serious," involving a "premeditated" attack that intended to kill police.

The man shouted "Allah" and other words that police officers did not understand, Comes said, adding that Spanish intelligence services are helping with the investigation.

The body of a man who tried to attack a police station is carried out of the premises in Cornella near the northeastern Spanish city of Barcelona on August 20, 2018. Getty Images

But he added that police have found no evidence linking the incident to terror attacks last August in Barcelona and nearby Cambrils, which killed 16 people.

Get Breaking News Delivered to Your Inbox

Officers opened a locked police station security door to the man, who lived in a nearby apartment, Comes said. The police station is located in the Cornella district on the outskirts of the city.

He said the suspect repeatedly pressed the buzzer to be let in at around 5.45 a.m. and spoke with officers inside over an intercom. After they decided to let him in, he pulled out "a large knife" and lunged at officers, according to Comes.

The man had ID documents on him and police are checking whether they are authentic.

Comes said authorities have found no criminal record for the man identified in the documents, although international police databases are being searched for matches with his fingerprints.

Police were planning to search the man's apartment.