BEIRUT — Staffan de Mistura, the U.N. special envoy for Syria, said Wednesday that he would leave his post at the end of November, closing a chapter of the seven-year war in which diplomacy has frequently been outgunned by overwhelming force on the battlefield.

About half a million people have died in the conflict, which has shredded the country’s social fabric and created one of the largest refu­gee crises since World War II.

As the United Nations’ most senior diplomat working on the crisis, de Mistura showed unwavering commitment to the U.N.-backed Geneva peace process, even as the Syrian army marched toward victory, the space for negotiations shrank, and the center of political gravity moved toward separate talks supported by Russia, one of President Bashar al-Assad’s greatest allies.

Speaking at a news conference in New York, de Mistura, 71, said Wednesday that he was leaving the position for personal reasons. 

“I am not laying down the charge until the last hour of the last day of my mandate,” he said.

The Italian-Swedish diplomat is the third person in the role. His predecessors — former U.N. secretary general Kofi Annan and veteran Algerian diplomat Lakhdar Brahimi — left their posts in frustration at the global deadlock over how to end the war.

In his closing comments, de Mistura said he had told the U.N. Security Council that Secretary General António Guterres had instructed him to “verify once and for all” whether a credible, balanced committee to draft a postwar constitution for Syria could be convened.

“One month can be a century in politics. . . . I have always been an optimist,” he said.

Diplomats and negotiators working on the Syria crisis veered Wednesday between frustration at the envoy’s perennial optimism and acknowledgments that he had faced an “impossible task.”

“He fought to the end, but he was only ever adding polish to a situation that could only be solved by geopolitics, not one man,” one Western diplomat said.

“He was and is a consummate diplomat,” said another Western diplomat. “Even if peace has so far eluded him, in the Geneva process and what followed, he set out clearly the parameters of peace. . . . In the end, his stamina and patience are remarkable.

The diplomats spoke on the condition of anonymity because they were not authorized to discuss the situation with the media.

With backing from Russian warplanes and Iranian troops, Assad’s army retook almost all of the opposition’s strongholds over the course of de Mistura’s tenure, even as the U.N.-backed peace talks continued in Geneva.

In January, participants at a Russia-backed peace conference in the Black Sea city of Sochi agreed to form a committee to rewrite the Syrian constitution, with the government, opposition groups and the United Nations each picking a third of the committee’s membership. De Mistura, and, by extension, Geneva, tacitly backed it.

The Syrian government’s offensives took a devastating toll on opposition-held areas. Entire suburbs and neighborhoods of Damascus and Aleppo were flattened. Hospitals were bombed. At times, the bombing was so intense that civilians were unable to bury their dead.

“If there is a political will, there is no reason for the constitutional committee not to be convened in November,” de Mistura told the Security Council on Wednesday.