Updated

A knife-wielding man who shouted "Allahu Akbar" was arrested Tuesday after he attacked a Spanish police officer near the Spanish-Moroccan border, authorities said.

The man, who appeared to be Moroccan, carried out the apparent terror attack about 7:35 a.m. local time at the Beni Enzar access to the Spanish enclave of Melilla, a spokeswoman with the local office of the Interior Ministry said. Hundreds of people were gathered in the area -- the frontier between Spain and Morocco -- to cross the border.

The attacker pulled out a knife and shouted the Arabic phrase "God is Great," striking the officer in the finger, an official said.

Officers nearby restrained the man. He was arrested and was being questioned by police.

The Associated Press contributed to this report.