KABUL (Reuters) - At least 3,812 Afghan civilians were killed or wounded in the first half of 2019 in the war against militant groups, including a big increase in the number of casualties caused by government and foreign forces, the United Nations said on Tuesday.

The latest casualty figures were released as talks between the Taliban and U.S officials to end the 18-year Afghan war entered an important stage, with U.S. negotiators aiming to reach a peace deal before Sept. 1.

However, the war has raged on despite the diplomatic efforts, forcing civilians to live under the constant threat of being targeted by militants or being caught up in ground fighting, or becoming inadvertent victims of air strikes by Afghan government and foreign forces.

The UN Assistance Mission in Afghanistan (UNAMA) said in its latest report ground raids and clashes caused the most civilian casualties, followed by bomb attacks and air strikes.

Taliban and Islamic State fighters killed 531 Afghans and wounded 1,437 between Jan. 1 and June 30. The hardline Islamist groups deliberately targeted 985 civilians, including government officials, tribal elders, aid workers, and religious scholars, UNAMA said in its report.

It said pro-government forces killed 717 Afghans and wounded 680 in the six months to June 30, a 31% increase from the corresponding period in 2018.

At least 144 women and 327 children were killed and more than 1,000 wounded across the country.

Air strikes caused 519 civilian casualties, 150 of whom were children.

“Parties to the conflict may give differing explanations for recent trends, each designed to justify their own military tactics,” UNAMA human rights chief Richard Bennett said.

“The fact remains that only a determined effort to avoid civilian harm, not just by abiding by international humanitarian law but also by reducing the intensity of the fighting, will decrease the suffering of civilian Afghans,” he said.

U.S. and other NATO troops are stationed in Afghanistan on a mission to train, assist and advise Afghan forces and some members of U.S. forces carry out counter-terrorism operations.

Colonel Sonny Leggett, a spokesman for U.S. forces in Afghanistan, rejected the methods and findings used by UNAMA, saying the collection of evidence by U.S. forces was “more thorough, evidentiary and accurate”.

Leggett, however, did not give any U.S. military figures for civilian casualties but said U.S. forces worked closely with Afghan security forces to prevent them.

“We follow the highest standards of accuracy and accountability and always work to avoid harm to civilian non-combatants,” Leggett said.

The United States is trying to negotiate a deal under which foreign forces would pull out in return for security guarantees by the Taliban, including a pledge that the country will not become a safe haven for terror groups.

The Taliban control or contest half the country, more than at any time since being overthrown by U.S.-led Afghan forces in late 2001, but they have rejected calls for a ceasefire until all foreign forces leave Afghanistan.

The Afghan government and the Taliban were not immediately available to comment on the U.N. report.

(Story corrects reference in paragraph 1, 3 to foreign forces instead of NATO-led troops, explains U.S. forces role in paragraph 11)