The historical ties between Morocco and Indonesia dated back to 14th-century, when Ibn Battuta, a Moroccan traveller, in 1345 visited the court of Samudera Pasai Sultanate in present-day Aceh, Northern Sumatra. In his record he testify that the Sultan of Samudra performed his religious duties piously and observing the madhhab of Imam Al-Shafi‘i. At that time Samudra Pasai was the end of Dar al-Islam for no territory east of this was ruled by a Muslim ruler.