The original mosque was destroyed by an earthquake in 1766; the present building dates from 1800.
There have been two different buildings on the same site.