KABUL—Deadly violence in Afghanistan has marred the first-ever direct talks between Kabul and the Taliban, underscoring the high stakes that face the warring sides as they struggle to get negotiations off the ground to end nearly two decades of fighting.

Representatives of the Afghan government and the Taliban kicked off a historic first round of U.S.-brokered talks in Qatar’s capital nearly two weeks backago. But as the two teams wrangle over the agenda and framework for talks that are likely to drag out for months, if not longer, both factions have accused the other of ramping up attacks against their people in recent days.

The Afghan government has called for an immediate cease-fire as a first priority of the talks. The Taliban, whose greatest leverage is the ability to inflict violence, has so far refused.

Afghan President Ashraf Ghani repeated that call Wednesday in a speech to the United Nations General Assembly, saying the U.N. had a crucial role to play in helping the Kabul government uphold their shared values at the Doha peace talks with the Islamist group.

“At those talks, the Afghan people have a clear and urgent priority: a cease-fire,” Mr. Ghani said. “An urgent end to the violence will more than anything else give us a chance to progress.”

On Wednesday, Afghan officials said overnight Taliban attacks on security checkpoints in southern Afghanistan killed at least 28 Afghan policemen. The insurgents have killed dozens of government security personnel and nearly 100 civilians in several attacks over the past two weeks, officials say.

Government forces, meanwhile, continue to target the Taliban. Airstrikes on the group accidentally killed as many as 24 civilians in the northern province of Kunduz on Saturday, according to news reports. The Afghan Ministry of Defense said it was investigating claims of civilian deaths.

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

The attacks highlight how neither party is willing to cede ground without concessions from the other side.

More on the Peace Talks

  • Afghanistan and Taliban Begin First-Ever Direct Peace Talks (Sept. 12)
  • Afghan Peace Talks: What You Need to Know (Sept. 12)

Initial friction isn’t unusual in thorny peace processes. Peace talks in Syria have been stranded for years. The Yemeni peace process hasn’t moved beyond the initial stage. The Colombian government and FARC rebels took nearly four years to strike peace.

Nevertheless, the violence at home adds pressure on both the negotiating teams in Doha to find common ground—initially on two divisive issues.

The Taliban wants its deal with the U.S. in February to form the basis of its talks with the government. That means if the U.S. reneges on its pledges, the insurgents aren’t committed to continuing talks with Kabul. The Afghan government, which wasn’t part of that deal, wants the insurgents to adhere also to an Afghan-U. S. declaration that makes a commitment to negotiation and permanent cease-fire a prerequisite for a peace deal.

The U.S.-Taliban deal involves a phased withdrawal over 14 months of all American soldiers from Afghanistan as part of President Trump’s efforts to reduce America’s military footprint in the region ahead of the Nov. 3 elections. In exchange, the Taliban pledged to prevent al Qaeda and other terrorist organizations from operating in Afghanistan and to engage in negotiations with the Kabul government.

The Taliban also insists that the Sunni Hanafi school of thought should form the legal basis for the negotiations. The government worries that without a reference to nondiscrimination of its sizable Shiite minority and other religions, this will exclude parts of the Afghan population that enjoy protection in the Afghan constitution.

The Taliban have revealed little about their end goal, beyond a withdrawal of foreign forces and that Afghanistan must be ruled by Islamic law, despite the fact that Afghanistan’s constitution already dictates that no law can contravene Islam.

“At the moment, unfortunately, the level of violence is very high. The number of security incidents initiated by the Taliban in different parts of the country has increased, not decreased,” Abdullah Abdullah, the head of the government negotiating team, said Tuesday in a virtual meeting organized by the Council on Foreign Relations.

Taliban spokesman Zabiullah Mujahid said the government was responsible for the uptick in violence by continuing operations to build new check posts.

The continuing violence is a reminder of the scars—emotional and physical—that the two delegations carry with them into the talks. Fawzia Koofi, one of three women in the government delegation, arrived in Doha with her injured arm in a cast after surviving a recent attempt on her life.

“It’s hard emotionally, but we have to find a way,” said Nader Nadery, a senior member of the Afghan government negotiation team whose nephew was killed in a Taliban attack days before the peace talks in Doha began.

The Afghan war 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. It has claimed tens of thousands of Afghan lives and destroyed hospitals, schools and other infrastructure.

In his speech at the U.N., Mr. Ghani, the Afghan president, said even a deal with the insurgents wouldn’t be enough to bring lasting peace to Afghanistan.

“For sustainable peace in Afghanistan, we must get to the root of the terrorism problem blighting our region, and address it as the global phenomenon and threat that it is.”

Write to Sune Engel Rasmussen at sune.rasmussen@wsj.com