News, views and top stories in your inbox. Don't miss our must-read newsletter Sign up Thank you for subscribing We have more newsletters Show me See our privacy notice Invalid Email

Cops have shot and killed a knifeman reportedly shouting "Allahu Akbar", who tried to attack officers at a police station near Barcelona early this morning.

The man stormed the building with the intention of attacking cops before being gunned down in the reception area, according to officials.

The attacker - named in Spain as 29-year-old Abdelouahab Taib, believed to be of Algerian origin - died as a result.

He had separated from his wife last week, El Periodico reports, and sources claim he "lost his head".

Taib, who did not have a previous police record, met his wife, a Spanish woman named Luci, 40, two years ago.

The couple married so he could remain in Spain, it is reported.

(Image: AFP) (Image: AFP) (Image: AFP) (Image: AFP)

Ambulances rushed to the scene, but he died as a result of his injuries.

The drama happened around 6am at a police station in Cornella on the outskirts of the Catalan capital, which is currently sealed off by investigators.

Police were also seen surrounding the apartment block where the man lived.

(Image: AFP) (Image: REX/Shutterstock)

Local reports said the man was a 29-year-old of Algerian origin and had shouted "Allahu Akbar" - which means "God is great".

An officer who was in the reception area of the police station is said to have shot him.

Police have opened an investigation in order to clarify the attacker's motive.

(Image: REX/Shutterstock)

The regional Mossos d’Esquadra police force confirmed the shooting in a tweet, declining to confirm reports the knifeman had been killed in their initial statement: “A man armed with a knife has accessed the police station in Cornella this morning with the aim of attacking officers.

“He has been taken out.

“The incident happened just before 6am this morning.”

(Image: AFP)

A Mossos d’Esquadra spokeman said she could not confirm he had been killed but local reports said emergency services had failed in their attempts to revive him when they reached the scene.

The incident happened just three days after the anniversary of the devastating terrorist attack in Barcelona’s Las Ramblas.

Moroccan Younes Abouyaaqoub, 22, used a rented van to mow down and kill 22 people including British-born Julian Cadman, seven, in Barcelona’s famous Las Ramblas on August 17 last year.

Police shot dead Younes in vineyards in Subirats an hour’s drive west of Barcelona after he went on the run following the Barcelona massacre. He was later buried in an unmarked grave in a funeral held in secret in his homeland.