A knife-wielding man, who reportedly shouted "Allahu Akbar" as he stormed a Barcelona police station, was shot dead Monday morning in an incident officials said is being treated as a terrorist attack.

The attacker, identified by Spanish media as 29-year-old Abdelouahab Taib, ran into the police station in the Cornella district on the outskirts of the Spanish city just before 6 a.m. local time. He pulled out a knife and reportedly yelled “Allahu Akbar."

The police station’s security door was closed ahead of Monday’s attack and the suspect repeatedly pressed the buzzer to be let in, speaking with officers inside over the intercom, Commissioner Rafel Comes, second-in-command of the Barcelona police, said during a press conference.

After police decided to let the man in, he pulled out “a large knife” and lunged at officers.

Police have not confirmed the attacker’s identity.

The attacker lived with a Spanish woman near the police station in the town of Cornella de Llobregat, just south of Barcelona, and he had no criminal record, El Pais reported. Comes said police are investigating the man’s background and are awaiting a warrant to search his apartment.

Officials said the attacker had “homicidal and premeditated will” when he stormed the police station with a knife of “considerable dimensions.”

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.

Monday's attack came just three days after the one-year anniversary of the terror attacks on Barcelona and nearby Cambrils, which killed 16 people. Comes said police have found no evidence linking those attacks to Monday's incident.

The Associated Press contributed to this report.