Masmak Fort was built around 1865 by the prince of Riyadh Abdulrahman ibn Sulaiman ibn Dabaan under the reign of Mohammed ibn Abdullah ibn Rasheed (1289–1315 AH), the ruler of Ha'il to the north, who had wrested control of the city from the rival clan of Al Saud. In January 1902 the young Amir Abdulaziz bin Abdul Rahman bin Faisal Al Saud, who was at the time living in exile in Kuwait succeeded in capturing the Masmak fortress from its Rashid garrison. The event, which restored Al Saud control over Riyadh, has acquired almost mythical status in the history of Saudi Arabia and has been retold many times.
The Fort is situated in the commercial center of the old city of Riyadh. It was used by King Abdulaziz from 1902 to 1938 when he moved his court to then newly built Murabba Palace.