Muhammad built on the nascent state created by his father, and continued to secure his realm's independence by alternatively allying with other powers, especially Castile and the Marinids, and sometimes encouraging them to fight each other. A sense of identity also emerged in the realm, united by religion (Islam), language (Arabic), and an awareness of an ever-present threat to its survival from its Romance-speaking Christian neighbours. Historian Ibn Khaldun commented that these ties served as a replacement for "asabiyyah" or tribal solidarity, which Ibn Khaldun thought was fundamental to the rise and fall of a state.