The foundations of the mosque date back to just a generation after the life of the Prophet Mohammed (PBUH), who died in 632 AD.