Two U.S. service members were killed in Afghanistan on Monday when a member of the Afghan security forces opened fire on them, according to two U.S. military officials.

The shooting took place in Kandahar. The officials said the Afghan gunman was shot and wounded, and is currently in the custody of Afghan forces.

The unidentified U.S. service members who were attacked had been assigned to advise and assist Afghan forces, the officials said.

The commanding officer of the 3rd Brigade Combat Team, 82nd Airborne Division, announced the deaths in a message that was posted to the unit's Facebook page.

"It is with a heavy heart that I inform you of the loss of two paratroopers from the brigade during combat operations," Col. Art Sellers wrote.

"I ask you to respect the official Department of Defense notification process, a process which may take a few days. If you receive any information about these combat operations, either factual or speculative, I ask you to refrain from sharing it for the sake of the paratroopers’ loved ones."

The deaths bring the number of U.S. troops killed in action in Afghanistan this year to 12; three others died from nonhostile acts. A total of 13 U.S. service members were killed in hostile incidents last year, and two others died from nonhostile acts.

Almost 60 U.S. troops have been wounded in action so far this year.

Cases of Afghan security personnel attacking U.S. troops, known as insider attacks, are relatively rare. In one of the most high-profile recent incidents, an Afghan guard opened fire at an October 2018 meeting attended by Gen. Austin Miller, the senior American commander in Afghanistan.

Miller escaped unharmed but Afghan Gen. Abdul Raziq, an American ally, was killed and two Americans were wounded.