So-called insider attacks have long been a problem for coalition forces in Afghanistan. At their peak in 2012, 61 coalition soldiers were killed by such attacks.

Major Taylor decided to join the military someday after the Sept. 11 attacks while attending Brigham Young University, according to a profile published in January in The Deseret News, a Salt Lake City newspaper. His five brothers also joined the Army in the years after the 2001 attacks, it said.

His wife, Jennie Taylor, said in the article that service was an important part of their lives, and an example for their seven children. “I hope they know that in our family, we help,” she said. “In our family, we do what we can. If it’s something we can do, and the call comes to serve, we say yes.”

Major Taylor urged others to action as well, saying on Facebook in January that whether “reading to children at a school, or simply helping a neighbor, there are ways all around us to brighten someone’s day.”

Last Sunday in what appeared to be his last Facebook post, he called on all Americans to vote. “Whether the Republicans or the Democrats win,” he said, it is important “that we all remember that we have far more as Americans that unites us than divides us.”

Accolades poured out for Major Taylor late Saturday across social media.

“He was the best of men with the ability to see potential and possibility in everything around him,” North Ogden’s website said in announcing his death. It added, “He was patriotic to the core and a shining example of what an American politician should be.”

Mitt Romney, the 2012 presidential candidate who is now running for the Senate in Utah, said on Twitter that he was “heartbroken” over the news.