Two U.S. Army Special Forces soldiers who were killed when American and Afghan troops were fired on during a mission in Afghanistan were identified by the Pentagon on Sunday.

The soldiers, both assigned to the 3rd Battalion, 7th Special Forces Group (Airborne) at Eglin Air Force Base in Florida, were Sgt. 1st Class Javier Jaguar Gutierrez of San Antonio, Texas and Sgt. 1st Class Antonio Rey Rodriguez of Las Cruces, N.M.

Both soldiers, who were both posthumously promoted, were 28 years old, according to the Department of Defense.

AFGHANISTAN 'INSIDER ATTACK' LEAVES 2 US SOLDIERS DEAD, 6 WOUNDED

The two were killed Saturday after they wound up in a firefight with a gunman that injured six others in the Nangarhar province in eastern Afghanistan.

“Sgt. 1st Class Gutierrez was a warrior that exemplified selfless service and a commitment to the mission, both values that we embody here in the 7th Special Forces Group,” Col. John W. Sannes, 7th Special Forces Group Commander said in a statement.

Gutierrez enlisted in the Army in 2009 as an infantryman and stationed at Fort Bragg. In 2012, he attended the Special Forces Assessment and Selection at Fort Bragg and was selected to attend the Special Forces Qualification Course, graduating in 2015 as a Special Forces Communications Sergeant. He was previously deployed once to Iraq and Afghanistan.

“Our priority now is to take care of his family and teammates, we will provide the best possible care possible during these trying times," Sannes said.

Rodriguez also enlisted with the Army in 2009 and completed training at Fort Benning in Georgia before it was assigned to the 3rd Ranger Battalion, 75th Ranger Regiment. He deployed eight times with the 75th Ranger Regiment and twice with 3rd Battalion, 7th Special Forces Group (Airborne) in support of Operation Freedom’s Sentinel.

“Sgt. 1st Class Rodriguez was selfless and served honorably; he was certainly among the best in our unit,” Sannes said. “Here at the Red Empire, we take care of our own, and Sgt. 1st Class Rodriguez’ family will forever be a part of us, we will assist them in any way we can to help them through these trying times.”

An Afghan defense ministry official, who was not identified because he was not authorized to speak to the media, told the Associated Press the shooter was an Afghan soldier who had argued with the U.S. forces before opening fire. He was not a Taliban infiltrator, the official said.

The U.S. military, however, has not officially called the incident an "insider attack," because the motive remains unclear and the shooter “was not one of the soldiers on the patrol,” a U.S. defense official told Fox News. Defense officials said Sunday the attack remains under investigation.

Such attacks have been frequent occurrences in the nearly two decades U.S. troops have been deployed in the country. In 2012, for example, 25 percent of American military deaths in Afghanistan were caused by allied Afghan forces, military officials have said.

On Saturday, military spokesman Col. Sonny Leggett issued in a statement saying those involved in the most recent attack were "engaged by direct firing."

JIM HANSON: GET OUT OF AFGHANISTAN — A CLEAR, SPECIFIC DECLARATION WOULD LET US LEAVE AND PUT OUR ENEMIES ON NOTICE

In addition to the Taliban, “we are not ruling out ISIS” being responsible for the attack, the defense official told Fox News. Nangarhar Province -- where the attack took place -- is home to roughly 200 fighters affiliated with the Islamic State.

U.S. special forces soldiers led the mission at the district center in eastern Afghanistan on Saturday afternoon. Typically, special forces will conduct these types of missions with conventional Army infantry soldiers for added security on the perimeter. They also partner with Afghan soldiers.

Since Jan.1, six U.S. service members have been killed in Afghanistan, including the two soldiers killed Saturday. Last year, 20 U.S. service members were killed in action there.

CLICK HERE FOR THE FOX NEWS APP

The Trump administration is weighing a decision to remove up to 4,000 US troops from Afghanistan.

There are currently roughly 12,000 US troops deployed there.

At the height of US military involvement in 2010, there were over 100,000 Americans deployed to Afghanistan and nearly 500 killed that year.

Fox News' Lucas Tomlinson, Nick Givas, and the Associated Press contributed to this report.