The imposing Mesjid Agung was built by Sultan Machmud Badaruddin at the beginning of the 19th century.