The Dome of the Rock in the old city of Jerusalem

Turkish President Recep Tayyip Erdogan on Tuesday urged all Muslims to visit and protect Jerusalem after violence broke out over metal detectors Israel installed and later removed from a sensitive holy site in the city.

"From here I make a call to all Muslims. Anyone who has the opportunity should visit Jerusalem, Al-Aqsa mosque," Erdogan said in Ankara. "Come, let's all protect Jerusalem."

He was referring to a site, known to Jews as the Temple Mount, which is central to the Israeli-Palestinian conflict.

Israel installed metal detectors at entrances to the mosque compound, which also contains the Dome of the Rock, following an attack on July 14 that killed two Israeli police officers.

Palestinians viewed the security measures as an Israeli attempt to assert further control over the site, and large protests led to deadly clashes.

"They are attempting to take the mosque from Muslim hands on the pretext of fighting terrorism. There is no other explanation," Erdogan said in a speech to ruling Justice and Development Party (AKP) lawmakers in parliament.

He said Israel's legitimacy rested on the extent of the respect it showed to Palestinians and their rights.

An Israeli foreign ministry statement called Erdogan's comments "mind-blowing, false and distorted", and suggested that he "deal with the problems in his own country".

"Jerusalem is a city whose government is committed to security, freedom, freedom of worship and respect for the rights of all minorities," the Israeli statement said.

Erdogan earlier also denounced attacks on synagogues in Turkey, referring to reports that an ultra-nationalist group threw stones at a synagogue in Istanbul last week.

"It does not make sense to attack synagogues here because something has happened at Al-Aqsa mosque. This does not suit our religion and it is not allowed," he said.