Hangzhou (China) (AFP) - The United States is committed to bringing the perpetrators of the attempted coup against Turkish President Recep Tayyip Erdogan to justice, President Barack Obama said Sunday.

Ankara accuses US-based cleric Fethullah Gulen of being behind the July uprising.

At talks with Erdogan on the sidelines of the G20 summit, Obama said: "We will make sure that those who carried out these activities are brought to justice."

Tensions between the two NATO allies have risen sharply since the failed coup attempt against Erdogan on July 15, with Ankara launching a wide-ranging crackdown and demanding that the US extradite Gulen.

An exiled former imam living in the eastern state of Pennsylvania, Gulen strongly denies any involvement with the bid to overthrow Erdogan.

The dispute has soured public perceptions of the United States in Turkey and risks undermining a deep security relationship.

US officials insist they will extradite Gulen if Turkey can present proof he was actually involved.

The meeting in Hangzhou was the two leaders' first face-to-face encounter since the coup attempt.

Obama said the US was committed to "investigating and bringing the perpetrators of these illegal actions to justice" and assured Erdogan of American cooperation with Turkish authorities.

Since July, Ankara has detained, removed, or arrested tens of thousands of people within the judiciary, military, education system and police force for alleged links to Gulen's movement or the coup itself.

US-Turkey tensions have also been strained by Turkey's bombing of Kurdish positions in northern Syria.

The targets included Kurdish groups that are backed by Washington and seen by it as integral to the fight against the Islamic State group.

Ankara accuses them of being in league with the Kurdistan Workers' Party (PKK), a group which has claimed responsibility for deadly attacks inside Turkey.