A member of the Afghan security force stands in front of a damaged building Reuters

An Afghan wedding turned into carnage as a gunfight between guests from two rival clans erupted during celebrations, leaving more than 20 people dead.

Some 400 people had been invited to attend the wedding of the son of a local religious authority, or mullah, in in the Salah district district of the embattled Baghlan province, often the scene of Taliban violence.

Guests included members of two families long at odds with each other.

"The clash broke out after a relative of a provincial police official was assassinated during the wedding party," Dih Salah police chief, Col. Gulistan Qasani, told AP.

Police said 21 people, aged from 14 to 60, were killed and eight injured in the shootout. The bride and the groom were said to have survived.

"When we collected the bodies it was difficult to determine who were the shooters and who were not, because I could not find any weapons," Qasani said.

The massacre came as the government is trying to fight the widespread gun culture, the heritage of decades of war.

Last week Kabul banned the sale of toy guns after several hundred children were reportedly injured during the Eid celebrations.