DUNGU, Congo — The American military helped plan and pay for a recent attack on a notorious Ugandan rebel group, but the offensive went awry, scattering fighters who carried out a wave of massacres as they fled, killing as many as 900 civilians.

The operation was led by Uganda and aimed to crush the Lord’s Resistance Army, a brutal rebel group that had been hiding out in a Congolese national park, rebuffing efforts to sign a peace treaty. But the rebel leaders escaped, breaking their fighters into small groups that continue to ransack town after town in northeastern Congo, hacking, burning, shooting and clubbing to death anyone in their way.

The United States has been training Ugandan troops in counterterrorism for several years, but its role in the operation has not been widely known. It is the first time the United States has helped plan such a specific military offensive with Uganda, according to senior American military officials. They described a team of 17 advisers and analysts from the Pentagon’s new Africa Command working closely with Ugandan officers on the mission, providing satellite phones, intelligence and $1 million in fuel.

No American forces ever got involved in the ground fighting in this isolated, rugged corner of Congo, but human rights advocates and villagers here complain that the Ugandans and the Congolese troops who carried out the operation did little or nothing to protect nearby villages, despite a history of rebel reprisals against civilians.