The Afghanistan government and the Taliban began on Saturday their first direct talks to end nearly two decades of fighting, a negotiation brokered by the U.S. as part of its plan to withdraw from its longest war.

Officials from the warring sides have convened in Doha, Qatar’s capital, for the talks, with Secretary of State Mike Pompeo attending the opening ceremony.

“Today is a truly momentous occasion,” Mr. Pompeo said at the ceremony. “Afghans have at long last chosen to sit together and chart a new course for your country. This is a moment to dare to hope.”

In the face of steep odds, Afghanistan’s leaders said they want to put the country’s conflict behind them.

“We have come here with good will and good intentions,” Abdullah Abdullah, the head of the Afghan government delegation, said in opening remarks Saturday morning. “We want all of the people of Afghanistan to be reunited under one roof again.”

The U.S. and the Taliban signed a conditional peace agreement in February that involved a phased withdrawal of U.S. troops from Afghanistan over the course of 14 months. In exchange, the insurgents pledged not to attack U.S. troops, to prevent al Qaeda and other terrorist groups from operating in Taliban-controlled areas and to discuss a long-term cease-fire with Kabul.

The Afghan government wasn’t part of the U.S.-Taliban talks, and little unites the current leaders with the insurgents, apart from a desire to end the war. But a permanent cease-fire, and likely some form of power-sharing arrangement, is needed to make that happen.

On Thursday, Mr. Pompeo said the number of U.S. troops in Afghanistan would be cut in the fall from about 8,400 currently to about 4,500. He said the troop drawdown, which comes alongside a reduction of the U.S. military force in Iraq, would continue as long as it didn’t compromise U.S. security.

Feb. 29: In Doha, Qatar, U.S. and Taliban leaders signed a deal that aims to end years of fighting. Photo: Hussein Sayed/Associated Press

Ahead of the talks, Afghan officials said the government was giving priority to an immediate cease-fire, while the Taliban is likely to focus on a power-sharing arrangement.

In short remarks at Saturday’s ceremony, the leader of the Taliban delegation, Mullah Baradar, said the group wanted an independent, united Afghanistan ruled by an Islamic political system, which represents all Afghans.

“We want in the future that Afghanistan, in the region and with other countries in the world, has positive relations based on mutual respect,” Mr. Baradar said.

Mr. Pompeo said the U.S. “is a proponent of a sovereign, unified, and democratic Afghanistan that is at peace with itself and its neighbors.” While the U.S. had found a democratic system to work best, he added, Washington didn’t seek to impose a political system on Afghanistan.

“We are prepared to support your negotiations, should you ask, but the time is yours,” Mr. Pompeo said.

The war in Afghanistan began with the U.S.-led invasion in response to the Sept. 11, 2001, terrorist attacks that al Qaeda orchestrated from the country, then ruled by the Taliban. The war claimed more than 180,000 Afghan lives, including combatants, between 2001 to 2019, according to the Uppsala Conflict Data Program at Uppsala University in Sweden. It also displaced tens of thousands of people and destroyed schools, hospitals and other vital infrastructure.

The site of a suicide attack at the end of August in Afghanistan’s northern Balkh province.

The site of a suicide attack at the end of August in Afghanistan’s northern Balkh province.

Photo: /Associated Press

The intra-Afghan talks are expected to be contentious and drag on. The start was delayed by six months, largely because of disputes over a prisoner exchange agreed upon in the U.S.-Taliban deal. The Taliban has for nearly 20 years denounced the Kabul government as American puppets and has repeatedly said its own goal is an Islamic theocracy. The Afghan constitution states that no law can contravene Islam, but also that the country is a democratic republic.

For its part, the Kabul government faces concerns from citizens and activists that a power-sharing arrangement with the insurgents would sacrifice hard-won progress, particularly on women’s rights. When the Taliban was in power, it banned women from education, most work and from leaving the house without a male guardian.

Mr. Pompeo, and other Western foreign ministers who also spoke at the ceremony via videolink, urged the Afghan delegations to protect the rights of women and minorities. Mr. Abdullah made the same request of the Taliban.

“My delegation and I are in Doha representing a political system that is supported by millions from a diversity of cultural, social and ethnic backgrounds from our homeland,” Mr. Abdullah said. If the two sides can come to durable peace that preserves the rights of all, “including men, women, minorities and victims of war, then both sides will be the peace heroes,” he said.

The peace process has progressed in fits and starts. Secret meetings between Afghan government officials and Taliban representatives go back at least a decade. The first official visit by the group to Kabul since 2001 happened in March, when a three-person Taliban delegation traveled to the capital to discuss the terms of the prisoner exchange.

The Afghan government has so far released some 5,500 Taliban prisoners, while the insurgents have released about 1,000 security forces. Saturday’s proceedings were made possible after six Taliban prisoners jailed for killing Australian and French soldiers arrived in Qatar on Thursday. Canberra and Paris had objected to their release but agreed they could be moved to house arrest in Qatar.

The lead-up to the talks was marred by violence and targeted assassination attempts. This week, a bomb in Kabul targeted Vice President Amrullah Saleh, killing 10 bystanders. In August, gunmen attacked and injured a female member of the government’s negotiation team, Fawzia Koofi. The Taliban denied involvement in both attacks.

Top representatives on both sides have been personally affected by the war and carry bitter memories with them into the negotiations.

The government’s chief negotiator, former intelligence chief Mohammed Masoom Stanekzai, was badly injured in the 2011 suicide bombing that killed former President Burhanuddin Rabbani, and was himself targeted in another bombing in 2014.

The Taliban’s political leader, Mr. Baradar, spent eight years in a Pakistani prison after being captured in 2010 when he was the group’s No. 2.

Write to Sune Engel Rasmussen at