A Utah mayor who was also a Utah Army National Guard major training commandos in Afghanistan was fatally shot by one of his Afghan trainees, officials said Sunday.

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.

He was a military intelligence officer with Joint Force Headquarters and was expected to return to his mayoral job in January. Another U.S. military member whose name was not immediately made public was wounded in Saturday's attack that killed Taylor, who died from wounds from small arms fire, military officials said.

Maj. Gen. Jefferson S. Burton, the adjutant general of the Utah National Guard, told reporters that Taylor's mission was to help train and build the capacity of the Afghan national army.

"He was with folks he was helping and training. That's what's so painful about this. It's bitter," Burton said. "I do believe that Major Taylor felt he was among friends, with people he was working with."

Utah media outlets cited a statement from NATO saying that Taylor was shot by one of the commandos being trained and that the attacker was killed by Afghan forces.

Taylor leaves behind a wife and seven children. His remains are scheduled to arrive at Dover Air Force Base in Delaware on Monday evening.

Utah Gov. Gary Herbert said Taylor "was there to help. He was a leader. He loved the people of Afghanistan... This is a sad day for Utah, for America."

"Brent was a hero, a patriot, a wonderful father, and a dear friend," U.S. Sen. Orrin Hatch of Utah said on Twitter. "News of his death in Afghanistan is devastating. My prayers and love are with Jennie and his seven young children. His service will always be remembered."

Taylor served two tours in Iraq and was on his second tour in Afghanistan.

Taylor in January when he was being deployed told local media that he was assigned to serve on an advisory team training the staff of an Afghan commando battalion.

Hundreds of residents of North Ogden lined the street to see him off as police escorted him and his family around North Ogden, a community of about 17,000.

Taylor became the city's mayor in 2013.