Updated

A 22-year-old soldier from Illinois and a 23-year-old soldier from Ohio were identified Friday as the U.S. Army Rangers who were killed this week fighting the Islamic State in Nangarhar Province, Afghanistan.

Sgt. Joshua P. Rodgers and Sgt. Cameron H. Thomas were killed -- possibly by friendly fire from either U.S. or Afghan forces -- while conducting a raid on an ISIS compound Wednesday night, Pentagon spokesman Capt. Jeff Davis said. The Rangers believe the raid killed at least 35 ISIS fighters -- including the head of ISIS-Khorasan in eastern Afghanistan, Abdul Hasid, the Pentagon added.

TALIBAN ANNOUNCE SPRING OFFENSIVE 1 WEEK AFTER AFGHANISTAN MASSACRE

The Rangers knew Hasid would be "well-protected," Davis said, adding that a total of 50 Rangers came under fire from all angles within minutes of landing near ISIS-K headquarters via helicopter.

Both Rodgers and Thomas were assigned to 3rd Battalion, 75th Ranger Regiment at Fort Benning, Ga.

2 U.S. ARMY SOLDIERS KILLED FIGHTING ISIS IN AFGHANISTAN

Rodgers and Thomas were on their third deployments to Afghanistan when they were killed. Rodgers was a Ranger Team Leader assigned to Company C while Thomas was an Anti-Armor Specialist assigned to Company D.

"Josh and Cameron proved themselves willing to go into danger and impose a brutal cost on enemies in their path," Defense Secretary Jim Mattis said.

Rodgers, born in Normal, Ill., enlisted in the U.S. Army after graduating from high school. He completed One Station Unit Training at Fort Benning as an Infantryman and graduated from the Basic Airborne Course. He was assigned to the Ranger Assessment and Selection Program 1, also at Fort Benning.

Thomas, born in Colorado Springs, Colorado, enlisted in the U.S. Army from his hometown of Kettering, Ohio, after he graduated from high school. He finished One Station Unit Training at Fort Benning as an Infantryman. He graduated from the Basic Airborne Course and then was assigned to the Ranger Assessment and Selection Program 1 and remained at Fort Benning.

The incident, which unfolded close to the site of the recently conducted Massive Ordnance Air Burst Bomb (MOAB) bomb strike, was under investigation. There were no indications any civilians were hurt, according to the Pentagon.

The Rangers called in Apache helicopters, AC-130 gunships, F-16 jets and drones when they found themselves surrounded in into the Mohmand Valley, Davis said, adding, "We knew going in this was going to be a very tough fight."

Fox News' Lucas Tomlinson and Leland Vittert contributed to this report.