The Pentagon said Thursday that the ISIS ambush on Kurdish forces in Iraq that killed a U.S. Navy SEAL was a surprise, and could have turned out differently if they had anticipated it.

U.S. Navy Petty Officer 1st Class Charles Keating was killed in the attack. Keating is the third U.S. service member to be killed in combat in Iraq since forces returned there in 2014.

"Obviously, had we had the forces there, been able to see this attack coming, they would have responded differently to it," Pentagon press secretary Peter Cook said. “Perhaps this could have been avoided. That's certainly something that we're looking at carefully. This particular attack was not anticipated and we were forced to respond."

Keating, 31, was shot when he and other special operations forces went to the rescue of U.S. forces who were caught in a gun battle involving more than 100 ISIS fighters, Army Col. Steve Warren said Wednesday.

The small team of American advisers went to Tel Askuf, about 14 miles north of Mosul, to meet with Kurdish Peshmerga troops Tuesday morning. Warren said ISIS fighters launched a large, complex attack on the Peshmerga there around 7:30 a.m. local time, with armored Humvees and bulldozers, and broke through the front lines.

Warren said it was one of the largest attacks that ISIS had launched in recent months, and it came in the wake of several recent defeats of militants in that region.

Warren said Keating was hit at about 9:30 a.m. and was evacuated for medical treatment, but "his wound was not survivable."

He said Keating was taken to a medical facility in Irbil and that both of the Black Hawk medical evacuation helicopters were hit by small arms fire.

According to Warren, even as the U.S. advisers were being rescued from the fight, a barrage of coalition aircraft — including F-15 and F-16 fighter jets, B-52 bombers, A-10 close air support aircraft and drones — responded and launched airstrikes on more than 30 locations, destroying truck bombs, vehicles and bulldozers and killing close to 60 enemy fighters. He said the peshmerga have regained control of the town.

Warren declined to release details about the quick reaction force, other than to note that often such teams are set up and put on standby when U.S. forces go out on missions in dangerous areas. The team of commandos is usually stationed relatively close by so that it can respond quickly if needed.

Cook was asked whether Defense Secretary Ash Carter was looking for ways to make the U.S. advisory mission less dangerous.

"We had a fatality of a U.S. service member and that requires hard questions," Cook said. "And so, we are looking at the situation in terms of force protection." He added: "And of course we'll be reassessing force protection going forward."

The Associated Press contributed to this report.