Major Brent Taylor of the Utah National Guard was killed on Saturday by an Afghan commando he was training.

An Afghan army officer penned an emotional letter of condolence to the family of an American military trainer and Utah mayor who was killed in an “insider attack” last weekend.

Major Brent Taylor of the Utah National Guard took a year-long leave of absence as mayor of North Ogden north of Salt Lake City for his deployment to Afghanistan where he was training Afghan commandos.

Taylor, 39, was killed on Saturday from small arms fire in the capital Kabul and the attacker was later shot dead by Afghan forces.

Major Abdul Rahman Rahmani – an Afghan pilot who flew missions with Taylor during his two tours of duty – addressed the letter to Taylor’s wife and their seven children.

“I want you all to know that most Afghans feel extreme sorrow and pain over the loss of your husband and father,” Rahmani wrote.

“When you think of our country, and his sacrifice, I can’t imagine your sorrow or sense of loss, but please don’t think that the violent act that took his life is representative of us or our sentiments towards Americans.”

The Afghan major noted he’s lost eight members of his family during 30 years of war and has himself twice been wounded.

Dear Mrs. Taylor,

Maj Taylor was my friend. I wrote this letter for his family.

I hope this little contribution eases your pain. Note: this letter was sent to his physical add by one my American mentors. I tried to email too but I failed to find her email. pic.twitter.com/28nH7o4W6D — Col Rahman Rahmani (@rahmanrahmanee) November 5, 2018

Taylor, a major and military intelligence officer, was expected to return to his mayoral job in January and come home to his wife, Jennie, and their seven children ranging from 11 months to 13 years old.

Rahmani posted the letter on Twitter after failing to locate Jennie Taylor’s email address. Jared Pack, Taylor’s brother-in-law, saw the post and forwarded it to his wife.

“That letter is like gold to the family,” Pack told BuzzFeed. “It gives so much context as to why he had gone to Afghanistan.”

Taylor served two tours in Iraq and was on his second tour in Afghanistan. His remains were scheduled to arrive at Dover Air Force Base in Delaware on Monday evening.

So-called “green-on-blue” attacks – when Afghan forces fire on international troops with whom they are working – have not been uncommon during the 17-year war.

The Taliban have managed to infiltrate the most secure government offices on multiple occasions this year.

Currently, there are about 14,000 US troops in Afghanistan, providing the main component of the NATO mission to support and train local forces there.