Family members had hoped to build a contraption for a fun gender reveal party in Iowa, but they instead built an explosive device that killed a grandmother, police said Monday.

'This family got together for what they thought was going to be a happy event with no intent for anyone to get hurt,' Marion County Sheriff Jason Sandholdt said.

Pamela Kreimeyer, 56, was killed when a piece of shrapnel from the device struck her in the head at the Saturday soiree in rural Knoxville, about 40 miles southeast of Des Moines.

Members of Kreimeyer's family got together Friday to begin experimenting with 'different types of explosive material' in hopes of creating a gender reveal device and recording the unveiling for friends and family on social media, the sheriff's office said in a statement.

'On Saturday afternoon five family members and the expectant mother gathered and placed gunpowder in the bottom of a homemade stand that was welded to a metal base plate,' the sheriff's statement said.

They drilled a hole in the side of the stand to install a fuse and placed a piece of wood on top of the gunpowder, before adding colored powder indicating the baby's gender, the statement said. The idea was that once the gunpowder ignited, it would launch the powder into the air -- typically blue for a boy or pink for a girl.

But when the family members placed tape over the top of the metal tubing, they inadvertently created a pipe bomb, authorities said.

Once the device was lit, the metal tubing exploded, sending shrapnel flying, the sheriff's office said.

A piece of metal hit Kreimeyer, who was standing with family members about 45 feet from the device, killing her, the statement said.

The chunk of metal moved with such velocity that after slamming into Kreimeyer, it continued to travel more than 400 feet through the air, landing in a field.

Kreimeyer was killed instantly, police said. The sheriff's office described her as a wife, mother and grandmother.

Sandholdt did not immediately return CNN's calls seeking additional information, including Kreimeyer's relationship to the expectant mother and the baby's gender.

The explosion remains under investigation. The Bureau of Alcohol, Tobacco, Firearms and Explosives is assisting in the investigation.

'This is a reminder that anytime someone mixes these things there is a high potential for serious injury or death; please do not take these unnecessary risks,' Sandholdt said in a statement.

Gender reveal parties have grown in popularity in recent years, with expectant parents and guests gathering to learn the genders of unborn babies.

The reveals can be as simple as cutting a cake or releasing balloons, but some events are more over the top. In Louisiana last year, an expectant father wedged a melon containing blue goo into an alligator's jaws.

Other celebrations have gone awry. A 2017 gender reveal in Arizona sparked a wildfire that burned 47,000 acres, while a July shindig in Australia ended prematurely when a car outfitted to belch blue smoke erupted in flames, forcing the driver and guests to flee.