Brent Taylor, 39, had taken a yearlong leave of absence as mayor of North Ogden north of Salt Lake City for his deployment to Afghanistan.
"North Ogden Mayor Brent Taylor was killed today while serving in Afghanistan", Cox wrote on his Facebook page. "I'm struggling for words. The entire Herbert family mourns with this soldier's family and we pray that their burdens may be lifted, and that the hearts of all Utahns will reach out to comfort them in their grief".
Taylor was a Ph.D. candidate at the University of Utah in worldwide relations after receiving a Bachelor of Arts at Brigham Young in political science and a Master of Public Administration from the Unifersity of Utah. "I will be assigned to serve on an advisory team training the staff of an Afghan commando battalion".
USA military officials say another service member whose name hasn't been released is being treated for wounds sustained in the attack.
Operation Resolute Support said in a news release Saturday it is investigating the incident, which is suspected of being carried out by a member of the Afghan National Defense and Security Forces. Afghan security forces members immediately killed the attacker.More news: Steven Gerrard interrupts question for player to clarify "warning" for Rangers squad
Utah Governor Gary Herbert and Major General S. Burton are planning to address the press on Sunday, Nov. 4, at 12 p.m.at the Utah National Guard's Draper headquarters.
Taylor had left his position in North Ogden, a city of around 17,000 people about 45 miles (70 km) north of Salt Lake City, earlier this year to serve in Afghanistan.
The Tribune reported that on the day of his deployment in mid-January, North Ogden police escorted Taylor and his family around town as hundreds of residents lined the streets to see him off.
The attacker was reportedly posing as a member of the Afghan National Defense and Security Forces, which US officials have hoped can take over battling terror groups in the region in the coming years.
Insider attacks in recent months also have claimed the lives of a Czech soldier and U.S. Army Command Sgt. Maj.
Taylor's last Facebook post touched on how inspired he had been by the elections in Afghanistan, as he encouraged people in the United States to vote on Tuesday. He said others had discouraged Taylor from deploying a fourth time, telling him, "You've done enough. His service to his community is going to be remembered forever".