Cornellà de Llobregat, Spain: A police officer shot dead a man armed with a knife as he tried to attack a police station in the northern Spanish region of Catalonia on Monday, in what authorities are treating as a "terrorist attack".
Police said the man invoked the name of Allah during the assault, which came just days after the first anniversary of a twin attack in Catalonia that killed 16 people.
The man arrived at the closed police station in the town of Cornella de Llobregat near Barcelona at 5:45 am (0345 GMT) and repeatedly pressed the buzzer to be let in, Rafel Comes, a commissioner with the Catalan regional police, told a news conference.
After police allowed him in, the man pulled out a "large knife" and lunged at officers in "a clearly premeditated desire to kill an agent of our force," Comes said.
"The officer used her gun to save her own life," Comes said, adding the man shouted "Allah" as well as words the police officers did not understand.
"These are enough indication to treat the events being investigated as a terrorist attack."
Anti-terrorism police sources had earlier told AFP the man was a 29-year-old Algerian, but Comes said police still needed to confirm that the Algerian identity papers he carried with him were in fact his.
The police station in Cornella de Llobregat, a working-class town of around 86,000 people, was quickly cordoned off after the attack and the attacker's body removed, according to an AFP reporter at the scene.
Police explosives experts searched the man's flat, which was located just a few hundred metres (yards) from the site of the attack.
Resident Conchi Garcia, a 50-year-old office worker, said the man came to the neighbourhood two years ago, when he moved in with a woman and her two daughters who had always lived in the area.
Security has been reinforced at police stations across Catalonia.
The incident occurred just days after the one-year anniversary of a deadly jihadist rampage in Catalonia.
Sixteen people were killed on August 17 and 18, 2017 when a van drove into crowds on Barcelona's popular Las Ramblas boulevard and in a knife attack in the nearby resort of Cambrils.
The Islamic State group claimed responsibility for the attacks, Spain's worst since the Madrid train bombings in 2004 when 191 people died and more than 1,800 were injured.
Spain has kept its terrorist alert at the second-highest level since 2015.