HANGZHOU, China — President Obama sought on Sunday to heal a rift with Turkey, expressing his wholehearted support for its president, Recep Tayyip Erdogan, in the wake of a failed effort to oust him and promising America’s help in bringing the coup plotters to justice.

Mr. Obama’s comments, after he met with Mr. Erdogan before a Group of 20 summit meeting here, seemed calculated to smooth over hard feelings in Turkey, where some officials had blamed the United States for fomenting the July 15 uprising by elements of the military.

He said nothing about Mr. Erdogan’s crackdown after the coup, in which tens of thousands of people were arrested. And his reference to helping Turkey bring the perpetrators of the uprising to justice was not accidental: Mr. Erdogan is demanding that the United States extradite Fethullah Gulen, a Turkish Muslim cleric living in Pennsylvania whom he accused of inciting the coup.

“This is the first opportunity that I’ve had to meet face to face with President Erdogan since the terrible attempted coup,” Mr. Obama said, facing the Turkish leader across a long table. “We’re glad you’re here, safe, and that we are able to continue to work together.”