Police officials in Spain say Spanish and Moroccan security forces have thwarted another attempt by African migrants to illegally cross over from Morocco to Spain's North African enclave of Melilla.

Police say at least 1,000 migrants tried to scale razor wire fences early Thursday but failed to get through.

The attempt came just hours after Spain announced measures to deter migrants, mostly from west Africa, from storming Melilla and its sister enclave, Ceuta.

Spain said it would invoke for the first time a 1992 agreement with Morocco allowing it to send back to Morocco any Africans who had succeeded in getting into Ceuta or Melilla.

Earlier Wednesday, about 500 migrants in Morocco tried storming a fence surrounding Melilla. About 65 people successfully climbed over the fence while dozens of others suffered serious cuts from razor wire.

Some information for this report provided by AP and Reuters.