Media playback is unsupported on your device Media caption Afghan police and plain-clothed security officials fire shots into a crowd of about 500 protesters in Kabul

President Barack Obama has apologised to the Afghan people for the burning of Korans by American troops at a US base.

In a letter to President Hamid Karzai, Mr Obama expressed his "deep regret" and said the incident earlier this week was a genuine mistake.

Demonstrations against the desecration have continued for a third day across northern and eastern Afghanistan.

Two US soldiers and two Afghans were killed in an attack on a military base. Elsewhere there were four other deaths.

On Wednesday, another seven people were killed and dozens injured in protests.

Mr Obama's letter, delivered by the US ambassador to Afghanistan, assured the Afghan president that US authorities would question all those responsible.

Analysis The Afghan authorities are being blamed for poor handling of the violence and an intelligence failure in several cases. Critics say security forces have been slow to deploy in the provinces, especially after MPs called for jihad [holy war] on television and local radio stations. In Nangarhar province, mosque loudspeakers were used in several villages urging people to collect their guns - but Afghan forces took no action until armed demonstrators attacked the Nato base. In neighbouring Laghman province, local mullahs knocked on doors and asked people to join protests against Afghan and international forces. Police and troops did better in Kabul, preventing hundreds of demonstrators from entering the city. President Karzai and his aides had a long day urging politicians, provincial governors, tribal elders and religious leaders to spread the message of peace and calm. One official close to Mr Karzai said news of the burnt Korans had travelled like a bullet all over the country. Another aide said the demonstrations were like a wild fire out of control. There is a state of high alert ahead of prayers on Friday.

"I convey my deep sympathies and ask you and the people to accept my deep apologies," the letter said.

"The error was inadvertent; I assure you that we will take the appropriate steps to avoid any recurrence, to include holding accountable those responsible," it continued.

President Karzai told members of the Afghan parliament that a US officer was responsible for the burning.

But he said it was done out of "ignorance".

In addition to those killed, many people have been injured in the protests, some of them critically, while armed men on Thursday also attacked at least two military installations.

Crowds shouting "death to Obama" have been throwing stones and setting fire to the US flag.

Meanwhile the Taliban have called on Afghans to kill and beat all invading forces in revenge for "insulting" the Koran.

In a statement a Taliban spokesman said Afghans should "not stop at protesting" but instead target military bases and personnel to "teach them a lesson that they will never again dare to insult the Holy Koran".

'Death to America'

The BBC's Andrew North, in the Afghan capital, says many officials sympathise with the outrage the US has provoked across the country.

He says Friday prayers may spark more tensions, depending on the tone set by religious leaders.

Image caption The protests have become more widespread

Police, local officials and tribal elders have told the BBC there have been major protests in a number of areas across the country, involving many hundreds of people.

In Khogyani in Nangarhar province, a man wearing an Afghan army uniform killed two US soldiers. Two protesters were also killed and seven injured as Nato forces opened fire when armed men attacked the US/Afghan base

In Uruzgan province, two people were killed and at least eight others wounded, three of them police, in clashes between protesters and Afghan security forces, local officials told the BBC's Bilal Sarwary

Image caption There have now been three days of protests over the burning of the Koran at a US military base

In northern Baghlan province, one civilian was killed and two others injured, while two police were also hurt

One person was killed in Laghman province, east of Kabul, where local police said several hundred people were chanting "Death to America"

More than 3,000 people gathered in Mehtar Lam, the capital of Laghman province, with some burning an effigy of President Obama

Fights broke out in Kabul as hundreds of protesters were stopped from entering the centre

In Asadabad, some 1,500 demonstrators were said to be burning US flags and tyres and shouting anti-American slogans.

A French military base to the east of Kabul was attacked

Muslims consider the Koran the literal word of God and treat each book with deep reverence.

Last year, at least 24 people died in protests across Afghanistan after a hardline US pastor burned a Koran in Florida.