The nation mourned the loss of 19 elite firefighters in a wildfire in Arizona this weekend as a “perfect storm” of circumstances engulfed the men.

“It had to be a perfect storm in order for this to happen. Their situational awareness and their training was at such a high level that it’s unimaginable that this has even happened,” said Prescott Fire Department spokesman Wade Ward on the Today show on ABC.

19 Firefighters Killed in Arizona Wildfire: News

The fire, called the Yarnell Hill Fire, began on June 28, possibly due to lightening, and has since engulfed 8,400 acres of dry chaparral brush and grass. Before the incident, the flames were licking up 15 to 20 feet, and the fire behavior was labeled “extreme” by the Arizona State Forestry Division. The flames moved closer to the nearby towns of Yarnell and Peeples Valley, which were evacuated.

The state forestry department dispatched on Sunday the Granite Mountain Hotshots, a group of elite firefighters who handle complex fires. The 20-men crew headed to the front. Their job was to tame the fire by clearing out a stretch of land, called a control line. A patch of forest empty of vegetation would mean the fire has nothing to consume, and it would stop advancing.

Little is known about what went wrong. Since the firemen did not get away, their planned escape routes and safety zones may have been compromised, creating a situation known in firefighting parlance is called “entrapment.” Some of the men were later found under fire shelters, which are tent-like structures made of a fire-resistant material. The shelters are meant to protect the men as the fire ranges around them. Others were outside the shelters, according to the New York Times.

Previous incidents where hotshot crews have headed into complex fires gives an idea of how the crews plan ahead to stay safe, and what can go wrong.

Wildfire Season Off to a Hot Start: Photos

On April 28, 2011, the Bull Fire flared across Arizona, near the Mexican border, growing to 1,200 acres in less than 24 hours. A hotshot crew was dispatched and they used tools such as rakes and chainsaws to clear out vegetation and create a control line. Meanwhile, a helicopter carrying two firemen — called a helitack crew — landed farther away from the control line, ready to help. All firemen operate in teams of two or more.

A safety plan was put in place for the helitack crew. If the fire blows up and the control line does not work, the topography suggested that the flames would head toward the helitack crew. To retreat, the men were to light a controlled fire and clear the area of any vegetation. Without fuel, the approaching fire would have nothing to burn, and the firefighters would be safe in the blackened zone.

The hotshot crew created the control line and left. Suddenly, the winds turned strong and gusty, and flames that had been one or two feet high reached up to eight or 10 feet and leapt over the control line.

The flames consolidated and raced toward the helitack crew. The two men started burning vegetation to create an escape route, but they were not clearing fast enough. As the flames formed a wall and entrapped them, the men dodged and ran through the least flames, fire shelters in their hands. They were evacuated by a helicopter and treated for second degree burns.

The incident suggests that much can go wrong on the front lines, even when a campaign is carefully planned. There have been 42 fatalities associated with burnovers and entrapments since 1990, according to the National Interagency Fire Center. Among the worst was the South Canyon Fire near Glenwood Springs, Colorado, which claimed the lives of 14 firefighters in 1994.

The fire began on July 2 from a lightning strike and grew over the next two days on an extremely dry ridge of pinyon-juniper trees. A seven person crew hiked two and a half hours to reach the fire and cleared a spot for a helitack crew. They began building a control line and later retreated. The fire quickly swallowed up this control line and advanced.

On July 6, nine members of the Prineville Interagency Hotshot Crew arrived and joined other firefighters, and began building a new control line. The winds suddenly increased in speed up to 45 miles per hour and the flame lengths increased to 100 feet. The fire reached a flammable patch of oaks and raced towards the firefighters. The firefighters were entrapped, and 14 men died.

An investigation of the South Canyon Fire revealed that the fire’s behavior could have been better predicted based on the topography and the weather, but the information was not taken into account when the firefighting plan was drawn up.

Still, few firefighters are better equipped to deal with such harrowing situations than hotshot teams, who train for environmental extremes. They go 21 days on assignments, hike with heavy packs and can work up to 14 hours a day.

The Yarnell Hill Fire continues to burn without being contained, and 500 workers are currently fighting it with more rolling in today.

IMAGE: A firefighter with the Silver City Hotshots is seen in front of burning embers while working to build a backfire up the mountain off Potrero Road to control the Springs Fire and protect homes in Newbury Park, California, May 3, 2013. (Patrick T. Fallon/Corbis)