Image copyright AP and AFP Image caption Associated Press journalists Anja Niedringhaus (left) and Kathy Gannon

Two journalists working for the Associated Press news agency have been shot by a police commander in eastern Afghanistan, officials say.

One of the women, Anja Niedringhaus, died in the attack. Her colleague, Kathy Gannon, is reported to be stable.

The attack took place in the town of Khost near the border with Pakistan.

It comes as Afghanistan intensifies security ahead of presidential elections on Saturday, in response to threats of violence by the Taliban.

Anja's tale Image copyright Other The day I enter a war zone and think it is normal is the day I will stop covering wars Anja Niedringhaus Niedringhaus: A photographer's tale In pictures: Anja Niedringhaus' works

The new president will succeed Hamid Karzai, who has been in power since the 2001 fall of the Taliban but is constitutionally barred from seeking a third consecutive term.

The BBC's Lyse Doucet in Kabul says the run-up to this historic poll has already been the bloodiest, and fears of electoral fraud are pronounced.

'Heartbroken'

The two journalists had been travelling with a convoy of election workers - protected by Afghan security forces - delivering ballots from the centre of Khost to the district of Tani, on the outskirts.

They were in their own car with an interpreter and an AP freelancer, AP says.

The freelancer said they had arrived in a heavily guarded compound shortly before the shooting.

As they were waiting in the back seat of the car for the convoy to move, a unit commander shouted "Allahu Akbar" (God is Great) and opened fire on them, the freelancer told AP.

He then surrendered to the other police and was arrested, the agency adds.

Anja Niedringhaus, 48, a German photojournalist who was part of a team that won the Pulitzer Prize for their coverage of the war in Iraq, was killed instantly.

Media playback is unsupported on your device Media caption Video of the scene of the attack shows bullet holes in the doors of the car

Canadian-born Kathy Gannon, 60, who had been the AP's bureau chief in Afghanistan for many years and is currently a special correspondent for the region, was shot twice.

Twitter tributes John-Thor Dahlburg, AP editor in Brussels, says: "Terrible day for AP and journalism overall" Edward Wong, New York Times correspondent in China, describes the attack as "horrific". "Both brave journalists," he tweets. Jon Williams, ABC foreign editor, says: "Devastated to learn of Khost attacks on two of best journalists covering #Afghanistan. Both at top of game. Thoughts with friends in Kabul."

She underwent surgery and is said to be in a stable condition.

"Anja and Kathy together have spent years in Afghanistan covering the conflict and the people there," said AP executive editor Kathleen Carroll.

"Anja was a vibrant, dynamic journalist well-loved for her insightful photographs, her warm heart and joy for life. We are heartbroken at her loss."

Rings of security

President Karzai expressed his sadness at the incident and pledged to carry out a full investigation.

Media playback is unsupported on your device Media caption Interior ministry spokesman Sidiq Siddiqi says it may have been a case of mistaken identity

The interior ministry said the officer who shot the women had commanded a police unit, which had been under 48 hours of mortar attack from insurgents across the border in Pakistan.

He may have mistakenly thought the car was carrying insurgents as the police were unaware that the journalists were travelling in the area, interior ministry spokesman Sidiq Siddiqi said.

The district lies on the border with Pakistan's Waziristan region, with the Pakistan-based Haqqani network strong and influential in the area.

Violence has increased across Afghanistan in recent weeks, ahead of the election, and foreign reporters have been among the victims.

Key questions ahead of the vote What are the main issues? A final security agreement with the USA is the most pressing issue. All other matters, from trying to bring the Taliban to the negotiating table to fighting corruption and the drugs trade, depend on this

A final security agreement with the USA is the most pressing issue. All other matters, from trying to bring the Taliban to the negotiating table to fighting corruption and the drugs trade, depend on this Will the vote be free and fair? There is widespread concern about ballot stuffing and ghost polling stations - the kind of cheating that has marked every election since 2004

There is widespread concern about ballot stuffing and ghost polling stations - the kind of cheating that has marked every election since 2004 Is security a major logistical problem? Yes. The Taliban have vowed to disrupt the vote and there were a string of attacks leading up to it. But security at this election will be tighter than in previous votes

Yes. The Taliban have vowed to disrupt the vote and there were a string of attacks leading up to it. But security at this election will be tighter than in previous votes What happens if no-one wins? If, as expected, no candidate wins more than 50% of the vote, the two top contenders will go to a run-off on 28 May Voters to defy Taliban Leaving Helmand to uncertain future Why the polls matter - in 60 seconds Before and after the Taliban

A senior AFP reporter, Sardar Ahmad, was killed alongside eight other people when Taliban gunmen attacked a hotel popular with foreigners in the Afghan capital, Kabul, on 21 March

A journalist with Swedish and British nationality, Nils Horner, was shot dead in Kabul by gunmen on 11 March

The BBC's Afghanistan correspondent, David Loyn, says the election is being protected by the biggest military operation since the fall of the Taliban - with the deployment of nearly 200,000 troops.

Rings of security have been set up around each polling centre, with the police at the centre and hundreds of troops on the outside.

There are eight candidates for president, including former foreign ministers Abdullah Abdullah and Zalmai Rassoul, and former finance minister Ashraf Ghani Ahmadzai.

If nobody wins more than 50% of the vote, a run-off election will be necessary.

Image copyright Reuters Image caption Anja Niedringhaus was well-known for her coverage from war zones, but she also covered sporting events. Here she is at the 2004 Olympic Games in Athens

Image copyright AP Image caption This is a photo Anja Niedringhaus took of a Pakistani soldier out on patrol on the border with Afghanistan in 2012

Image copyright Reuters Image caption Anja Niedringhaus and her AP colleague Kathy Gannon were covering the distribution of ballot boxes around Afghanistan when they were shot

Image copyright Reuters Image caption Ballot boxes have been distributed around the country amid tight security as Afghans prepare to vote in Saturday's presidential elections

A new president may give the US a chance to repair relations with Kabul, which dropped to an all-time low with Hamid Karzai late last year when he refused to sign a bilateral security agreement that would allow up to 10,000 troops to stay in Afghanistan when Nato combat missions end this year.