Get breaking news alerts and special reports. The news and stories that matter, delivered weekday mornings.

The mayor of a Utah city who was serving in Afghanistan was killed and another service member was wounded in an apparent "insider attack," officials said Sunday.

North Ogden Mayor Brent Taylor, 39, a major in the Utah National Guard, was killed Saturday while serving with his unit in Kabul, which is helping to train Afghan defense forces. The Utah National Guard said Taylor appeared to have been shot by a member of the Afghan National Defense and Security Forces, who was then shot and killed by other Afghan forces.

An undated photo of Brent Taylor on foot patrol while training Afghan border police in Afghanistan. North Ogden City

The incident was the second such insider attack in less than two weeks, after an Afghan commando killed one person and wounded two other people on Oct. 22.

Taylor leaves behind a wife and seven children ages 11 months to 13 years. A GoFundMe page that was set up to support his family had reached almost 80 percent of its goal of $250,000 by Sunday night.

Maj. Gen. Jeff Burton, the adjutant general of Utah's National Guard, said Taylor, 39, was "a man of excellence" and an "amazing human being" who was killed while serving his fourth deployment. He served in Iraq in 2006 and again in 2007 and was awarded a Bronze Star Medal for exceptionally meritorious service, and he was sent to Afghanistan in 2012 and again this year.

Burton characterized Taylor's death as a "betrayal," saying at a news conference that the region is still considered a combat zone where the Taliban remains active.

Let our news meet your inbox. The news and stories that matters, delivered weekday mornings. This site is protected by recaptcha

"It's bitter. He was with folks he was helping and training," Burton said. "That's what's so, ultimately, painful about this."

Brent Taylor, the mayor of North Ogden, Utah. North Ogden City

Just days before he died, Taylor posted a hopeful message on Facebook calling the elections in Afghanistan "beautiful to see" and called on Americans to vote in Tuesday's midterm election.

"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. "I am proud of the brave Afghan and U.S. soldiers I serve with."

"As the USA gets ready to vote in our own election next week, I hope everyone back home exercises their precious right to vote," he added. "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."

Utah Gov. Gary Herbert called Taylor a "great mayor of North Ogden," a city of about 19,000 people about 40 miles north of Salt Lake City.

"Maj. Brent Taylor was the personification of love of God, family and country," he said.

Utah Lt. Gov. Spencer Cox said on Twitter on Saturday that he was "struggling for words" after having learned of Taylor's death.

"I love Mayor Taylor, his amazing wife Jennie and his 7 sweet kids. Utah weeps for them today," he wrote. "This war has once again cost us the best blood of a generation."

Sen. Orrin Hatch, R-Utah, said in a statement that Taylor was a "dear friend" whose "service will always be remembered."

Taylor became mayor of North Ogden in 2013 after having served on the City Council. In January, he announced on Facebook that he was embarking on a one-year deployment to Afghanistan as part of an advisory team training the staff of an Afghan commando battalion.

"Serving as mayor of North Ogden city has been one of the greatest honors of my life and the highlight of my civilian professional career," he said. "Service is what leadership is all about."

"There are three great loyalties that have guided my life and everything in it, God, family, and country," he added.