Military deaths are a regrettable cost of waging war and can turn a nation against a war. Civilian deaths can turn an invaded nation against the invaders.

That’s what is happening in Afghanistan. A rising toll of civilian dead and wounded in that sideshow war, in which Iraq gets the greater attention, is arousing public and government opposition to the American presence.

A new United Nations report says that the number of civilian casualties in Afghanistan went up 39 percent so far this year as compared with 2007. Almost 1,500 civilians have been killed by either the Taliban or NATO and U.S. forces since the U.S. invasion in 2001, according to the United Nations Office of the High Commissioner for Human Rights. Only about half the deaths have been attributed to the Taliban.

Many of the deaths and injuries came in a series of aerial bombing raids by U.S. and NATO planes. At least 330 civilians died in what the Pentagon calls collateral damage in August alone.

NATO authorities, aware of the political hazard of increasing civilian casualties, last year ordered the use of smaller munitions, delaying tactics when civilians might be harmed and relying on the Afghan National Army for house-to-house searches. The civilian casualty rate went down for a time, but spiked again this past summer when many were killed in an air strike on July 6 on a wedding party and an Aug. 22 bombing in the small hamlet of Azizabad.

The latter incident, which eventually brought a visit by Afghan President Hamid Karzai and a sympathetic phone call to him from President Bush, epitomized mistakes by the U.S. military. For two weeks, the U.S. military had described the Special Operations mission backed by American air support as a success and said only five to seven civilians and 30 to 35 militants were killed. New York Times correspondent Carlotta Gall toured the area, inspected newly-dug graves and interviewed villagers to conclude that more than 90 civilians, the majority of them women and children, were killed. A UN statement agreed with the 90 total and said about 75 of them were women and children.

U.S. officials have stood by the lower estimates and cite inspections that found only a few casualties and new graves. Afghan government and UN officials say that their higher toll was right and that the U.S. inspections were cursory and ineffective.

The dispute over Azizabad boils on, but Defense Secretary Robert M. Gates has agreed on a permanent joint investigative group to determine the facts about future civilian casualties and promised prompt apologies and compensation for survivors.

Civilian casualties, often the result of the use of air power, can counter American efforts to win the hearts and minds of another people, something the U.S. cannot afford.