A police officer received light injuries Tuesday after a man shouting “Allahu Akbar” — “God is Great” in Arabic — attacked with a knife, but his rampage was short lived thanks to a quick-witted colleague.

The man, thought to be a 29-year-old Moroccan citizen, was arrested by officers after he was disabled during the confrontation at the land border between Spain and Morocco at Melilla. Now released security footage shows officers surrounding the man after he attacked one officer — leaving him with a cut hand.

The attacker has his sights set on officers as he approaches — but this distracts him from what is going on behind as one quick-thinking officer grabs a plastic road barrier and takes a long run-up. As the barrier connects with the back of the would-be terrorist’s head, he collapses to the floor and the other officers move in to make their arrest.

A spokesman for the Spanish government said of the incident: “A man entered the border post and once inside, pulled out a large knife and confronted (police) shouting ‘Allahu Akbar’ (God is Greatest), slightly injuring a policeman”.

Breitbart London has reported on the Morocco-Spain border, as it surges in popularity as a crossing point for migrants from Africa to Europe. The United Nations warned Spain to prepare for a surge in June, as the number of arrivals into the country from Morocco doubled, as migrants sought a “safe route” compared to the often lethal sea crossing from Libya to Italy.

Remarking on the influx of yong men, predominantly from countries like Cameroon, Gambia, Guinea, and the Ivory Coast, a UN spokesman warned Spain to prepare to recieve. They said: “What is clear is that, they (Spain’s government) have to get ready.

“They can’t be caught unprepared. What started happening elsewhere in Europe in 2015 can’t be allowed to happen here.”

AFP contributed to this report