The Taliban denied any involvement, saying the attack Saturday was triggered by a personal dispute.
However, local Afghan officials said the family was accused by the Taliban of working in prostitution. The insurgents sentenced them to death for immoral acts, then stormed the house and opened fire, according to Jawed Bedar, a spokesman for Faryab province's governor.
The infant girl's mother and twin sister survived, but both of the child's legs had to be amputated, the spokesman said.
He said Afghan security forces deployed to the village early Sunday and helped evacuate the two survivors to the hospital.
He said the Taliban attacked the government troops when they arrived. The ensuing gunbattle killed three Taliban members, who Bedar said were involved in the family's killing.
The Taliban control the village in Andkhoy district where the killings took place, making it difficult to accurately determine what happened, he added.
Locals in the area also disputed the accounts of prostitution. Instead, they claimed that a member of the slain family was a former Taliban militant who recently joined the peace process, according to Andkhoy district chief Sultan Mohammad Sanjer.
It was not immediately possible to reconcile the conflicting accounts.
Scores of Afghan civilians have also been killed in the crossfire and by roadside bombs planted by militants.