The Afghan army missed a Taliban target and hit a cattle market with mortars, killing tens of civilians, the United Nations has found.
The Taliban and Afghan military blamed each other for the attack in Sangin district, Helmand province, on Monday.
At least 23 people, including children, were killed and 15 people were injured, officials said.
Image: The UN has warned the Afghan army and the Taliban about fighting in civilian areas such as Sangin. File pic
The area is under Taliban control, but spokesman Qari Yusouf Ahmadi denied the group was involved in the incident, saying the military fired mortars into the market.
An army spokesman said a car bomb and mortar shells were fired by the insurgents and that there was no military activity in the area on Monday.
The army also said two Taliban fighters were killed when a car bomb detonated in the marketplace.
However, an investigation by the UN's assistance mission in Afghanistan (UNAMA) found that the Afghan army was to blame as it hit the market while responding to Taliban fire.
More from Afghanistan
Afghanistan car bomb and mortar attacks kill 23 at busy market
Trump: Nobody told me about Russia bounties to attack US troops
Russia offered Taliban-linked fighters bounties to attack British troops - as senior Tory MP seeks answers
Coronavirus: The West's focus on COVID-19 is being used by governments to further crises
Babies orphaned by hospital terror attack pictured on ward as Taliban denies blame
Mothers and newborn babies killed in Kabul maternity hospital attack
A statement from the organisation said: "UNAMA's initial impartial findings indicate Afghan National Army mortars inflicted heavy civilian casualties Monday at a market in Sangin, Afghanistan.
"Multiple credible sources assert that the ANA fired lethal mortars in response to Taliban fire, missing intended target." 'A ceasefire is not possible in Afghanistan'
It urged both sides to "stop fighting in civilian-populated areas", adding that indirect fire incidents on the ground in Afghanistan cause thousands of civilian casualties each year.
The statement added: "Dozens were killed and injured in Monday's incident, including children Final number of casualties to be verified."
The UN called on the Afghan government to set up an independent investigation team to look into the market incident.
"UNAMA is prepared to assist all parties, the victims and their families in establishing the fact," it said.
Russia offered Taliban-linked fighters bounties to attack British troops
:: Listen to the The World Tomorrow on Apple Podcasts, Spotify, Spreaker
Afghan President Ashraf Ghani had strongly condemned the "brutal and inhuamane act" on Monday as he also blamed the Taliban.
Despite repeated warnings by the UN for both sides to be more careful of civilian casualties, they are on the rise.
The violence has not been quelled despite planned talks between the Taliban and Kabul representatives from as early as next month in Doha, Qatar, where the Taliban maintain a political office.