Afghanistan's government and religious leaders struggled to mollify angry worshippers Friday, as a new wave of deadly protests against the burning of Qurans at a U.S. military base swept across the country.

While most of Friday's demonstrations ended peacefully, several degenerated into turbulent clashes between Afghan police and marchers chanting anti-American slogans.

Afghans hold an effigy of President Barack Obama at a demonstration Friday near Kabul. Some two dozen people have been killed in protests.

The deadliest of these clashes took place in Herat, a normally tranquil city in western Afghanistan, where demonstrators tried to march toward the U.S. consulate compound. At least seven people were killed and 65 injured during confrontations with the Afghan security forces in the province, according to Mahiddin Noori, a spokesman for the Herat governor.

At one point during the unsuccessful attempt to reach the U.S. Consulate, three demonstrators were killed when they set fire to a police truck equipped with heavy ammunition. The truck exploded amid the group of police and protesters.

In total, at least two dozen people have been killed, including two U.S. soldiers, in four days of violence that erupted after U.S.-led coalition forces at the Bagram Airfield tried to burn a truckload of Islamic literature, including copies of the Quran, Islam's holy book.

Two American servicemen of NATO's International Security Assistance (ISAF) were shot dead in Afghanistan's interior ministry as rage over the burning of Korans at a NATO base continued to grip the country. (Video: Reuters/Photo: AP)

Afghan workers said they rescued the books from the incinerator and then smuggled them off the base to show to local leaders. That ignited an escalating series of violent protests that have targeted coalition military bases, Afghan government buildings, United Nations offices and other symbols of Western presence in the country.

The U.S. has tried to mute the anger by launching an investigation and repeatedly apologizing for the occurrence. On Thursday, President Barack Obama expressed his "deep regret" to President Hamid Karzai in a personal letter to the Afghan president in which he vowed to hold to account those responsible for the Bagram incident.

U.S. military officials have said the books were set aside for destruction because Afghan detainees at the Parwan military detention center at Bagram were using them to trade messages and share extremist writing. But it remains unclear why the soldiers decided to burn copies of the Quran—a particularly incendiary affront to Muslims who view the book as the sacred word of God as relayed to the Prophet Muhammad.

On the eve of Friday's protests, Mr. Karzai and the country's religious leaders tried to limit the violence by urging people to express their anger peacefully. Preachers in mosques across Kabul sought to reinforce that message during Friday's weekly prayers.

"Those who burned the Quran are illiterate," thundered a preacher in Kabul's Khaled Ibn Walid mosque. "They don't know what religion is, but for us the solution is not violent demonstrations that kill our own people."

Similar messages in mosques across Kabul prevented chaotic anti-American marches from sweeping the city center.

Martine van Biljert, co-director of the independent Afghanistan Analysts Network, described the day as better than people feared.

"It may be difficult to explain to the rest of the world, but in a way this is what relative restraint looks like in a country awash with weapons and frustration, and that has suffered for decades from the young men itching for a fight and the leaders accustomed to using religiously fueled violence as a political tool," she wrote on her group's blog.

Across the country and in the outskirts of Kabul, Afghan police trying to block the marchers from converging on Western compounds clashed with protesters.

In Herat, shooting erupted as hundreds of protesters, some of them armed, tried to march toward the U.S. consulate, local officials said. Outside the city, demonstrators burned two police stations, Mr. Noori said.

As worshippers gathered for Friday prayers, U.S. Marine Gen. John Allen, commander of the International Security Assistance Force in Afghanistan, urged Afghans to be patient and wait for the results of the investigation.

"Working together with the Afghan leadership is the only way for us to correct this major error and ensure that it never happens again," he said in a statement.

On Thursday night, Gen. Allen, accompanied by the Afghan Army Chief of Staff Gen. Sher Karimi, flew to a joint U.S.-Afghan base in eastern Afghanistan where an Afghan soldier opened fire on American forces during a protest earlier that day, killing two.

"Now is not the time for revenge," Gen. Allen told U.S. soldiers gathered at the small base in Nangarhar province. "Now is the time to look deep inside your souls and remember your mission. Now is how we show the Afghan people that, as bad as that action was at Bagram, it was unintentional, and American's and ISAF soldiers do not stand for this."