The El Badi Palace is located north of the Royal Palace and was originally part of the Saadian-era palace complex. It was built by Saadian Ahmad al-Mansur after his success against the Portuguese at the Battle of the Three Kings in 1578.[51] The lavish palace was intended to receive and impress the sultan's guests.[23][52]