SOCHI, Russia (Reuters) - The leaders of Russia and Turkey on Wednesday publicly re-affirmed their commitment to working together to end the conflict in Syria, despite a gas attack on a Syrian city that tested their fragile alliance.

Russian President Vladimir Putin (L) shakes hands with his Turkish counterpart Tayyip Erdogan during a meeting in Sochi, Russia. Sputnik/Alexei Nikolsky/Kremlin via REUTERS

Russian President Vladimir Putin and his Turkish counterpart Tayyip Erdogan, both subject to mounting criticism from Western governments over their rights records, have formed a pact on Syria despite backing rival sides in the civil conflict there.

They met on Wednesday in the Russian Black Sea resort of Sochi, their first meeting since a deadly April 4 chemical attack on the Syrian city of Khan Sheikhoun.

Erdogan at the time blamed the attack on Russia’s ally, the Syrian government, while Putin suggested the attack had been faked to discredit Syrian President Bashar al-Assad.

Speaking to reporters after their talks, Putin and Erdogan said they were still focused on working together to end the conflict in Syria, which has turned the country into a breeding ground for violent Islamist militant groups.

“We stand by our Russian friends in the fight against terror,” Erdogan said at a joint press conference, standing alongside Putin.

Both leaders said they would maintain their support for a stop-start peace process, based in the Kazakh city of Astana, in which Moscow, Ankara and Tehran are co-sponsors.

In the latest round of talks there, representatives of Syria’s armed opposition said they were suspending their participation.

SAFE ZONES

Erdogan and Putin also voiced support for a proposal, backed by U.S. President Donald Trump, to create so-called safe zones in Syria to protect civilians from the fighting.

“We all take the view that we need to... create mechanisms that would guarantee a cessation of bloodshed and create the conditions for the start of a political dialogue. In this respect our position and that of the Turkish president totally coincide,” Putin said.

On the gas attack, Putin and Erdogan did not mention previous differences over who was to blame. Instead, Erdogan said that he had reached agreement with Putin that whoever was responsible should be punished.

Russia’s military intervention in support of Assad has kept the Syrian president in power, while Turkey backs the armed opposition groups who are trying to oust him.

Slideshow ( 3 images )

Turkey shot down a Russian air force jet in 2015 near the Turkish-Syrian border, creating a diplomatic crisis and prompting trade sanctions. Putin and Erdogan say they have put that crisis behind them.

Some diplomats see the alliance between Erdogan and Putin as offering at least a chance of steering the warring sides in Syria towards talks after six years of fighting that has killed hundreds and thousands of people and displaced millions.

Some of the trade restrictions introduced after the Russian jet was shot down are still in place, a lingering irritation in Russian-Turkish relations.

After the talks in Sochi on Wednesday, Russian Deputy Prime Minister Arkady Dvorkovich said Turkey had agreed to lift restrictions on imports of Russian wheat within days. There was no immediate confirmation of this from Turkish officials.

Turkey is the second largest Russian wheat importer after Egypt. For Turkey’s flour millers, Russian wheat is one of the most important sources of supply.

Putin, at his joint news conference with Erdogan, said though that Russia would leave in place for now some of its restrictions on Turkey -- an embargo on tomato imports and curbs on entry visas for Turkish citizens.

Putin said that Russia would resume buying Turkish tomatoes, but it needed time to make sure that Russian farmers who sank money into growing tomatoes at home did not lose out on their investment.