It was supposed to be a happy moment, a chance to declare the sex of a soon-to-be-born baby with a blast of color and burst of attention on social media.

But the gender reveal party explosion that killed an Iowa woman last weekend highlights the extreme lengths to which some families go to advertise on social media that they’re expecting a boy or a girl.

Gender reveal parties have grown increasingly popular and elaborate, with smoke, confetti or colored treats to symbolize the soon-to-be-born child’s biological sex. But what began as a lighthearted, intimate gathering with family and close friends has morphed into a spectacle with guns, explosives and wild animals to maximize shock value — with sometimes dangerous consequences.

“There’s this huge pressure to publicize these once-private moments,” said Carly Gieseler, an associate professor at the City University of New York’s York College, who has studied the rise of gender-reveal parties. “You get that outside validation that what you did was unique, that it was extra special. It drives celebrations to the extreme because you’re trying to do the thing that no one’s done before.”

Gieseler said the number of gender reveal parties has risen over the last decade but speculated that the recent string of accidents could cause it to decline.

The homemade explosive that killed 56-year-old Pamela Kreimeyer in Knoxville, Iowa, on Oct. 26 was just the latest example. The device was meant to spray colorful powder into the air, but instead exploded like a pipe bomb. Kreimeyer, who was standing 45 feet away, died instantly when a piece of debris struck her head.

Two years ago, an off-duty Border Patrol agent accidentally started a 47,000-acre wildfire in southern Arizona when he shot a target filled with an explosive powder and blue coloring to signal that he was expecting a son. Agent Dennis Dickey was charged with a misdemeanor and sentenced to probation for triggering the fire, which caused more than $8 million in damage.

In Australia, a car that spewed blue smoke to announce the arrival of a boy burst into flames last year, forcing the driver and passengers to abandon it.

And in separate instances over the last two years, couples announced their child’s sex by putting items into the mouths of their pet alligators — a watermelon filled with blue Jell-O in Louisiana and a pink-powder-filled balloon in Florida.

The use of homemade explosives is particularly concerning to fire officials, who worry about one-upmanship and copycats.

“These explosives are very unpredictable,” said Ron Humphrey, a special agent in charge of the Iowa State Fire Marshal Division. “You can set 10 off and get 10 different results. If we can get any message across to people, it’s to tell them simply not to do it.”

Just one day after the deadly Knoxville explosion, authorities in nearby Waukee, Iowa, received multiple calls about a blast outside of town. No one was injured, but the shockwave from the commercially available “gender reveal kit” rattled homes as far as 2 miles away. Waukee Fire Department Captain Tomme Tysdal said one neighbor complained about broken windows.

Event planners say they’ve seen an increase in formal gender reveal parties in recent years. Most draw between 30 and 50 people, and some couples even rent event halls for their announcement, said Bonnie Rosa-Mosena, a Des Moines-area wedding and event planner.

“It’s not enough just to have grandma and grandpa there,” she said. “They want all of their friends. It’s a big party.”

Rosa-Mosena said one of her client couples used a confetti cannon for their gender reveal party, but guests stood far away when it was fired. Another client revealed the baby’s gender while skydiving with a blue aerial flare, signaling a boy.

Gender reveal parties have been a social media staple since 2008, when an expectant mother, Jenna Karvunidis, posted a blog item on a parenting website about a family barbeque where she had baked a cake with pink icing inside to reveal that she was having a daughter.

The story was picked up by The Bump, a pregnancy magazine, and placed in OB-GYN offices throughout the country. It quickly spread online.

Karvunidis said she was horrified to see her idea co-opted with dangerous activities, and she chose not to have any ceremony when she was pregnant with her younger daughters.

“The whole thing is just absolutely insane,” said Karvunidis, now a law student in Los Angeles.

Even so, shooting an exploding target for a gender reveal party appealed to Jon Sterkel, the owner of a tree care business in Scottsbluff, Nebraska. Sterkel’s celebration in 2017 drew international media attention, but authorities ticketed him for detonating the kit without a state permit. Sterkel apologized, saying he didn’t realize he needed one, and prosecutors dropped the citation.

Sterkel said he and his wife bought the target because they had shot similar explosives in the past with proper safety precautions. They named their son Wesson, after the gunmaker Smith & Wesson.

“It’s just an everyday thing out here,” said Sterkel, who lives 20 miles from the Wyoming border. “We’re just a bunch of rednecks who love hunting and shooting, and we thought this was going to be a pretty unique way to do it. If it’s done in the right way, in the right environment, then it’s totally enjoyable.”