BUTTE, Montana — At least 786 children died of abuse or neglect in the US in a six-year span in plain view of child protection authorities — many of them beaten, starved or left alone to drown while agencies had good reason to know they were in danger, the Associated Press has found.

To determine that number, the AP canvassed the 50 states, the District of Columbia and all branches of the military — circumventing a system that does a terrible job of accounting for child deaths. Many states struggled to provide numbers. Secrecy often prevailed.

Most of the 786 children whose cases were compiled by the AP were under the age of 4. They lost their lives even as authorities were investigating their families or providing some form of protective services because of previous instances of neglect, violence or other troubles in the home.

Take Mattisyn Blaz, a 2-month-old from Montana who died when her father spiked her “like a football,” in the words of a prosecutor.

Matthew Blaz was well-known to child services personnel and police. Just two weeks after Mattisyn was born on June 25, 2013, he came home drunk, grabbed his wife by her hair and threw her to the kitchen floor while she clung to the newborn. He snatched the baby from her arms, giving her back only when Jennifer Blaz called police.

Jennifer Blaz said a child protective services worker visited the day after her husband’s attack, spoke with her briefly and left. Her husband pleaded guilty to assault and was ordered by a judge to take anger management classes and stay away from his wife.

She said the next official contact between the family and Montana child services came more than six weeks later — the day of Mattisyn’s funeral.

The system also failed Ethan Henderson, who was only 10 weeks old but already had been treated for a broken arm when his father hurled him into a recliner so hard that it caused a fatal brain injury.

Maine hotline workers had received at least 13 calls warning that Ethan or his siblings were suffering abuse — including assertions that an older sister had been found covered in bruises, was possibly being sexually abused and had been burned by a stove because she was left unsupervised.

Ethan himself had arrived at daycare with deep red bruises dappling his arm.

Still, the caseworker who inspected the family’s cramped trailer six days before Ethan died on May 8, 2012, wrote that the baby appeared “well cared for and safe in the care of his parents.”