Police are hunting a gunman who fired up to four shots at a mosque in the Spanish exclave of Ceuta, on the northern coast of Morocco.

Nobody was killed or injured in the attack, which happened at dawn on Monday as some worshippers were praying inside, police sources told Spanish news agency EFE.

The motive for the shooting was not immediately clear.

The incident occurred at the Muley el Mehdi mosque, one of the most important religious sites in Ceuta and where the start of Ramadan has been celebrated for several years.

Witnesses said an individual on a motorbike fired the shots at about 3.30 a.m. Monday before escaping, according to local news site El Faro de Ceuta.

The Muley al Mehdi mosque was built in the Franco era in gratitude to Muslim troops who fought for Spain.