NASHVILLE — A 4-year-old boy grabbed a loaded gun at a family cookout and accidentally shot and killed the wife of a sheriff's deputy, authorities said on Monday.

The shooting Saturday evening was inside the Lebanon home of Wilson County Deputy Daniel Fanning.

Fanning was showing his weapons to a relative in a bedroom when the toddler came in and picked up a loaded gun on the bed, officials said. The weapon discharged as soon as the child picked it up, hitting 48-year-old Josephine Fanning, said Wilson County Sheriff Robert Bryan.

Josephine Fanning was pronounced dead at the scene. The child was not related to her or her husband.

The Tennessee Bureau of Investigation was called in because the investigation involved an official with the sheriff's department.

Bryan said the shooting was a terrible accident.

"Danny Fanning is going to have to live with it," the sheriff said. "Our prayers, our thoughts go out to him and the child."

The sheriff said the guns were normally stored in a safe, and the deputy had placed one on a bed to get to another gun. "Within seconds this small 4-year-old comes into the room, unbeknownst to the officer, and just picked up the gun and shot her."

Bryan said Fanning has worked in the department for about eight or nine years and is a school resource officer.

He said he would wait for the TBI to complete its investigation before making a decision about what to do with the deputy, but did not anticipate that the shooting would affect Fanning's job.

The gun was not Fanning's service weapon, TBI spokeswoman Kristin Helm said.