Spanish police said on Monday (Aug 20) they were treating as a terrorist attack an attempted assault on a police station near Barcelona by a man armed with a large knife who was then shot dead.
"Right now we are treating this as a terrorist attack," regional investigative police chief Rafel Comas told a news conference, adding that the attacker had said "Allah is great".
Regional police said on Twitter the man had entered the police station in Cornella, near Barcelona, just before 0400 GMT "with the aim of attacking the officers" adding he had then been shot.
"An investigation has been launched following the events that occurred this morning at our police station in Cornella in order to clarify the reasons for the attack," a statement said.
A police spokeswoman said she could not give any further information.
State broadcaster RTVE said the attacker was a 29-year-old Algerian resident in Cornella with Spanish identity documents, and had been killed by the gunshot.
The central government's representative in Catalonia, Teresa Cunillera, called for "prudence" before deciding what the attacker's motive was and until police had finished their investigation.
"Until there have been a minimum of checks, of looking into the whys, it is very difficult to draw any conclusions," she told public radio.
The police station was cordoned off and funeral home employees removed the attacker's body from the building, an AFP photographer at the scene said.
Officers searched the man's home, which was located just a few hundred metres (yards) from the site of the attack.
The incident occurred just days after the first anniversary of a deadly extremist rampage in Catalonia.
Sixteen people were killed on Aug 17, 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.
ISLAMIC STATE TARGETS POLICE
Spain has kept its terrorist alert at the second-highest level since 2015.
Catalonia, which is home to a significant number of second-generation immigrants, has had a long history of Islamic militant activity.
Spain's first Muslim extremist - a member of the Algerian Armed Islamic Group (GIA) - was uncovered in Catalonia in 1995.
Mohammed Atta, the pilot who slammed a passenger plane into one of New York's World Trade Center towers on Sep 11, 2001, spent time in Catalonia shortly before the attacks.
And in 2008, a plot targeting Barcelona's underground trains was foiled when it was already in advanced stages.
One in four people detained in Spain in relation to extremist Muslim-linked terrorism come from the province of Barcelona in Catalonia, according to a study published last year by the Real Instituto Elcano, a Spanish think-tank, which called the province the country's "main centre of jihadist activity".
There have been a string of similar incidents in neighbouring France targeting police and soldiers, including one in January 2016 in which police shot dead a man wielding a cleaver and yelling "Allahu akbar" as he tried to attack a police station in northern Paris.
That incident came on the one-year anniversary of the terrorist attack on satirical newspaper Charlie Hebdo.
The Islamic State group has frequently called on their followers to attack soldiers and police in France, who they see as a legitimate target because they represent the French state.