Spanish officers on Monday shot dead an Algerian man who tried to attack them with a knife at a police station while shouting "Allahu akbar" (God is greatest), police 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 meant to kill police.
"A man armed with a knife entered the police station in Cornella to attack the officers". The man, named as Abdelouahab Taib, was "intending to attack the officers", according to a statement published by the police on Twitter.
Spanish police confirmed on Monday that a knifeman had been shot at a police station in the north eastern region of Catalonia at about 6am on Monday. Once inside, he drew a large a knife and shouted "Allahu Akbar" [Allah is the Greatest] - the familiar Islamic phrase which has increasingly come to be associated with the opening stages of terror attacks across Europe in recent years.
"For now, we are treating it as a terrorist attack", he added.
Police searched his home, located near the site of the attack, as part of their ongoing investigation.
Last Friday, Barcelona commemorated the first anniversary of an Islamist assault in which a young man drove a van down a busy central boulevard, killing 14 and injuring over 100 in Spain's worst attack in more than a decade.
He said police were checking whether they were authentic.
The Islamic State (IS) group claimed responsibility for the attacks.
Catalonia, which is home to a significant number of second-generation immigrants, has had a long history of Islamic militant activity.
The nature of his injuries after being shot by the police are not yet known.
The Spanish government's representative in Catalonia, Teresa Cunillera, said in a radio interview that authorities have not determined a motive for the attack.