@nprofile1q... as somebody from the U.S. living in Spain, I wouldn’t be at all surprised if the U.S. is involved in some way.
But this is also simplistic.
There are complicated relations between Spain and Morocco, and Pedro Sánchez just met with Algeria (Morocco-Algeria relations are bad, not just complicated), and something similar on immigration though at smaller scale happened in 2021 that Morocco turned out to have facilitated.