Nothing is like a common enemy.
“The northern mountains might not be very conducive to peace in normal times. But these were not normal times. These peoples were all Christian, and they shared an enemy on the other side of the mountains.”
https://unchartedterritories.tomaspueyo.com/p/a-brief-history-of-spain