Military officials said 39-year-old North Ogden Mayor Brent Taylor was shot to death Saturday by an Afghan commando he was training, who was then killed by Afghan forces.
Major Taylor had been expecting to return as Mayor Taylor in January. His death leaves behind his wife, Jennie, and their seven children, ranging from 11 months to 13 years old.
She was there as his remains were returned to Dover Air Force Base in Delaware.
"Brent may have died on Afghan soil, but he died for the success of freedom and democracy in both of our countries," she said in a statement that referred to her husband's final post on Facebook, which urged Americans to exercise their "precious right to vote."
"It seems only fitting," her statement said, that her husband "has come home to US soil in a flag draped casket on our Election Day."
Taylor's post , drawing a connection between democracy abroad and at home, has been seen and shared thousands of times.
"It was beautiful to see over four million Afghan men and women brave threats and deadly attacks to vote in Afghanistan's first parliamentary elections in eight years. The strong turnout, despite the attacks and challenges, was a success for the long- suffering people of Afghanistan and for the cause of human freedom," he wrote.
"As the USA gets ready to vote in our own election next week, I hope everyone back home exercises their precious right to vote. And that whether the Republicans or the Democrats win, that we all remember that we have far more as Americans that unites us than divides us. "United we stand, divided we fall." God bless America."
Taylor, a military intelligence officer with Joint Force Headquarters, served two tours in Iraq and was on his second tour in Afghanistan.
"He was with folks he was helping and training. That's what's so painful about this. It's bitter," Maj. Gen. Jefferson S. Burton, the adjutant general of the Utah National Guard, said on Sunday. "I do believe that Major Taylor felt he was among friends, with people he was working with."
Taylor had become mayor in 2013, and had a local hero's farewell when he was being deployed last January. Hundreds of residents of North Ogden, about 40 miles (65 kilometers) north of Salt Lake City, lined the street to see him off as police escorted him and his family around the community of about 17,000.
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."