KABUL — An Afghan police commander opened fire Friday on two Associated Press journalists, killing Pulitzer Prize-winning photographer Anja Niedringhaus and wounding veteran correspondent Kathy Gannon — the first known case of a security insider attacking journalists in Afghanistan.
The shooting was part of a surge in violence targeting foreigners in the run-up to Saturday’s presidential elections, a pivotal moment in Afghanistan’s troubled recent history that promises to be the nation’s first democratic transfer of power.
The two journalists were traveling in a convoy of election workers delivering ballots in the eastern city of Khost, under the protection of Afghan security forces. They were in their own car with a translator and an AP Television News freelancer waiting for the convoy to move after arriving at the heavily guarded security forces base in eastern Afghanistan.
A unit commander identified by authorities as Naqibullah walked up to the car, yelled ‘‘Allahu Akbar’’ — God is great — and fired on them in the back seat with his AK-47, said the freelance videographer, who witnessed the attack, which left the rear door of the car riddled with bullet holes.
The officer then surrendered to the other police and was arrested.
Niedringhaus, 48, who had covered conflict zones from the Balkans in the 1990s to Iraq, Libya, and Afghanistan, died instantly of her wounds.
Gannon, 60, who for many years was the news organization’s Afghanistan bureau chief and currently is a special correspondent for the region, was shot three times in the wrists and shoulder. After surgery, she was in stable condition and spoke to medical personnel before being flown to Kabul.
Niedringhaus and Gannon had worked together repeatedly in Afghanistan since the 2001 US-led invasion, covering the conflict from some of the most dangerous hotspots of the Taliban insurgency.
They often focused on the war’s impact on Afghan civilians, and they embedded several times with the Afghan police and military, reporting on the Afghan government’s determination to build up its often ill-equipped forces to face the fight against militants.
Gannon, who had sources inside the Taliban leadership, was one of the few Western reporters allowed into Afghanistan during the militant group’s rule in the 1990s.
While there have been repeated cases in recent years of Afghan police or military personnel opening fire on and killing international troops working with the country’s security forces, Friday’s attack was the first known insider shooting of journalists.
Past insider attacks have been carried out by suspected Taliban infiltrators or Afghans who have come to oppose the foreign presence in the country. At their worst, in 2012, there was an average of nearly one a week, killing more than 60 coalition troops and prompting NATO to reduce joint operations with Afghan forces.
Taliban spokesman Zabihullah Mujahid denied responsibility for Friday’s attack. Khost Provincial Police Chief Faizullah Ghyrat said the 25-year-old attacker confessed to the shooting and told authorities he was from Parwan province, northwest of Kabul, and was acting to avenge the deaths of family members in a NATO bombing there.
The claim could not be corroborated and officials said they were still investigating the shooter’s background.
Ghyrat said the police commander told authorities he had seen the journalists, decided to act, and then demanded the assault rifle from one of his subordinates.
Karzai said in a statement that he ‘‘grieved’’ Niedringhaus’ death and wished a quick recovery for Gannon. He also ordered an investigation into the shooting.
In a memo to staff, AP President Gary Pruitt remembered Niedringhaus as ‘‘spirited, intrepid and fearless, with a raucous laugh that we will always remember.’’
‘‘Anja is the 32nd AP staffer to give their life in pursuit of the news since AP was founded in 1846,’’ he wrote. ‘‘This is a profession of the brave and the passionate, those committed to the mission of bringing to the world information that is fair, accurate and important. Anja Niedringhaus met that definition in every way.’’
Niedringhaus joined the AP in 2002, and while based in Geneva worked throughout the Middle East as well as Afghanistan and Pakistan.
In 2005, she was part of the AP team that won the Pulitzer Prize for breaking news photography for coverage of Iraq, and was awarded the Courage in Journalism Award from the International Women’s Media Foundation, among many journalistic honors.
In 2006-07, she studied at Harvard University under a Nieman Fellowship.
‘‘What the world knows about Iraq, they largely know because of her pictures and the pictures by the photographers she raised and beat into shape,’’ said AP photographer David Guttenfelder. ‘‘I know they always ask themselves, ‘What would Anja do?’ when they go out with their cameras. I think we all do.’’
Gannon, a Canadian journalist based in Islamabad, has covered Afghanistan and Pakistan for the AP since the mid-1980s.