An important event during his reign was the signing of the Treaty of Madrid in 1880. This treaty effectively gave international approval and protection for lands which had been captured by foreign powers. This set the stage for the French Protectorate in Morocco beginning in 1912. He managed to maintain the independence of Morocco while neighbouring states fell under European influence, such as Tunis which was conquered by France and Egypt which was occupied by Britain.