Soldiers and militiamen loyal to Yemen's government take position at the frontline of fighting against Houthi fighters the country's central province of Marib October 19, 2015. REUTERS/Stringer EDITORIAL USE ONLY. NO RESALES. NO ARCHIVE

Talks to end months of fighting in Yemen will convene in Geneva at the end of October under the sponsorship of the United Nations, the U.N. special envoy for the issue has announced, urging the parties to try to make the negotiations a success.

Previous U.N.-sponsored talks between the Yemeni government and Yemen’s Shi’ite militant group, the Houthis, failed in June, mainly because of differences over implementing a U.N. Security Council resolution calling for the Iran-backed Houthis to withdraw from cities they seized over the past year.

The U.N. special envoy to Yemen, Ismail Ould Cheikh Ahmed, wrote on his Facebook page late on Sunday that, after talks with President Abd-Rabbu Mansour Hadi in Saudi Arabia, he had managed to persuade all the parties to attend a new round of talks in Geneva at the end of this month.

“While offering thanks to all parties, the United Nations calls for more flexibility, for opportunities may not be conducive after this time,” he added.

The Yemeni government said on Sunday it had agreed to attend talks after the Houthis formally committed to implementing U.N.

Security Council Resolution 2216. The Houthis have previously said they would attend, but they have not commented since the Yemeni government announcement.

The Houthis wrote to U.N. Secretary-General Ban Ki-moon earlier this month to tell him they accepted the Security Council resolution. That resolution called on all sides, including the Houthis, to end the violence and avoid unilateral action that would jeopardize the country’s political transition.

U.N. diplomatic sources said Ahmed had delivered a letter last week from Ban to Hadi, seen by Reuters, reiterating that the Houthis had repeatedly confirmed their commitment to the resolution and urging Hadi to talk with them.

“Based on this commitment, I trust that you will now be in a position to authorise your government’s participation in a new round of consultations with the Houthis and their allies,” he added.

Western diplomats in New York have privately expressed frustration at Hadi’s reluctance to talk to the Houthis. They said that was probably reflected a Saudi preference for military victory to a negotiated settlement that would give the Houthis a say in the government.

The Yemeni government-run news agency sabanew.net cited an official in Hadi’s office as saying that the president had sent a letter to Ban on Monday that included the “readiness of the Yemeni government to participate in the talks with the coup factions … especially after affirming its commitment to the United Nations and its Special Envoy with implementing U.N.

Security Council Resolution 2216 without condition”.

At least 5,400 people have been killed in the fighting in the poorest country on the Arabian Peninsula, and the United Nations says the humanitarian situation, exacerbated by a Saudi blockade of Yemen’s ports, is “critical”.

Saudi Arabia has been leading an Arab military intervention since March to try to restore Hadi’s government, now based in Aden, and fend off what it sees as creeping Iranian influence.

The Saudi foreign ministry commended Hadi’s stand on the talks and welcomed the Houthi decision to honour U.N. Security Council Resolution 2216.

“It is considered a step in the right direction to solving the Yemeni crisis,” the ministry said in a statement attributed to a responsible source.