An Border Patrol agent pleaded guilty on Friday to causing a wildfire in Arizona while trying to reveal the gender of his baby.

Dennis Dickey, 37, pleaded guilty to a misdemeanor violation of U.S. Forest Service regulations by accidentally starting a blaze that caused more than $8 million in damages, according to a statement from the U.S. Attorney’s Office in Tucson.

Dickey was off-duty when he ignited the fire, dubbed the Sawmill Fire, which spread through federally administrated land in the Coronado National Forest, officials said.

ADVERTISEMENT

He was trying to reveal the gender of his and his wife’s baby by shooting at a target filled with a substance that would burst with color — either pink or blue, The Washington Post reported.

Dickey used Tannerite, a highly explosive substance, inside the target and shot at it with a high-velocity firearm, the U.S. Attorney’s Office said.

“Dickey fired shots at the Tannerite target, ultimately causing an explosion that started a fire that spread and resulted in damage to more than 45,000 acres of land managed by the State of Arizona, the U.S. Forest Service, the Bureau of Land Management, and various private landholders,” the office said.

It reportedly took nearly 800 firefighters more than one week to control the area.

Dickey, who admitted to starting the blaze, reported the fire immediately and cooperated with law enforcement, officials said.

Dickey pleaded guilty and was sentenced on Friday to five years probation. He will also make restitution payments totaling almost $8.2 million.

He will also make a public service announcement with the U.S. Forest Service on how he started the fire.

Gender reveal parties have become a viral trend in the last decade. Stephanie Shih, a spokeswoman for YouTube, told the Post that views on gender reveal videos spiked 60 percent in 2017 above the year prior. The trend is criticized for reinforcing gender stereotypes as well as not acknowledging that gender identity is different from biological sex, the newspaper reported.