TUCSON, Ariz. — A border patrol agent pleaded guilty last week to sparking a massive Arizona wildfire last year during a party where he and his pregnant wife would announce the gender of their baby.

Dennis Dickey, who was off duty at the time, was hosting the party April 23, 2017 when he filled a target with a colored powder, to reveal the gender of the baby, and tannerite— a legal but highly explosive substance. When the former agent fired his rifle, the baby's gender was revealed but he also ignited the blaze.

Those details were revealed during a court appearance Friday, the Arizona Daily Star reports. Days after the fire started, The U.S. Border Patrol said one of its agents was being investigated for possibly causing the fire while off duty and shooting a gun recreationally, but didn't release his name or any other details.

The April 2017 Sawmill Fire lasted about a week and caused more than $8 million worth of damage. In a plea agreement, Dickey agreed to five years probation and will pay $220,000 in restitution, according to the Arizona Daily Star. He will pay $100,000 of that when he is sentenced Oct. 9.

Hundreds of nearby homes were under pre-evacuation notices while the fire was burning.