A fire broke out in the historic mosque-turned-cathedral in Córdoba on Friday but the monument was saved as firefighters quickly contained the blaze, the Spanish city’s mayor has said.

Widely shared videos had shown flames and smoke billowing from inside the tourist attraction visited by 2 million people a year.

“The monument is saved. There will be no spread, it will not be a catastrophe, let’s put it that way,” José María Bellido said on Cadena television.

The fire brigade had earlier said the fire was under control but not extinguished.

The spectacular blaze broke out at about 9pm (8pm UK time), raising fears for the early medieval architectural gem and evoking memories of the 2019 fire that ravaged Notre Dame Cathedral in Paris.

ABC and other newspapers reported that a mechanical sweeping machine had caught fire on the site.

Considered a jewel of Islamic architecture, the site was built as a mosque – on the site of an earlier church – between the 8th and 10th centuries by the southern city’s then Muslim ruler, Abd al-Rahman, an emir of the Umayyad dynasty.

After Christians reconquered Spain in the 13th century under King Ferdinand III of Castile, it was converted into a cathedral and architectural alterations were made over following centuries.