TUCSON, Ariz. — A Border Patrol agent will have to serve probation for starting a wildfire in southern Arizona while he was off duty. The fire was sparked accidentally during a gender-reveal party stunt gone awry last year, his lawyer tells the Arizona Daily Star.

Federal prosecutors announced Friday that 37-year-old Dennis Dickey, of Tucson, has pleaded guilty to a misdemeanor violation of U.S. Forest Service regulations. He will face five years' probation and make a public service announcement about the fire.

The fast-moving "Sawmill Fire" was ignited near Green Valley in April 2017 when Dickey shot a rifle at explosive powder inside a target. Dickey's lawyer, Shawn Chapman, told the Daily Star that the incident happened during a party celebrating his wife's pregnancy, and the target contained blue or pink powder to announce the unborn child's sex. It also contained Tannerite, an explosive substance designed to detonate when shot at, according to a Department of Justice statement.

Get Breaking News Delivered to Your Inbox

Authorities say the blaze spread to the Coronado National Forest and burned more than 45,000 acres of federal, state and private land. The damage was estimated to be more than $8 million.

Dickey reported the fire immediately and admitted to starting it.

He is scheduled to be sentenced Oct. 9. He will be ordered to pay $220,000 in restitution under his plea agreement, Chapman told the paper.

"It was a complete accident," Dickey, 37, told U.S. Magistrate Judge Leslie A. Bowman Friday in court, the paper reports. "I feel absolutely horrible about it. It was probably one of the worst days of my life."

Chapman told the paper Dickey wasn't charged with arson because he didn't intentionally start the blaze. He said the charge is a petty offense and that he expects Dickey will likely keep his job as a Border Patrol agent. The Border Patrol didn't immediately respond to a request for comment from CBS News.

Chapman told CBS News he had no comment.