More than 40 people have died, many shot by police, and hundreds have been injured amid violence in Bangladesh over the sentencing to death of an Islamist politician by a court investigating the atrocities of the war of independence from Pakistan.

The Bangladesh court sentenced 73-year-old Delwar Hossain Sayedee, vice-president of the Islamist party Jamaat-e-Islami, to death on Thursday, finding him guilty of eight charges connected with the 1971 war, including murder, arson, rape and religious persecution, lawyers said.

The verdict first set off wild scenes of jubilation in Shahbag square, in the capital, Dhaka, where hundreds of thousands of people have been agitating for weeks in favour of executing Islamist politicians on trial for war crimes.

But clashes erupted when backers of Jamaat-e-Islami protested at the verdict. At least 14 demonstrators were said to have been shot dead by security forces across the country in the afternoon. Two policemen and a ruling party activist were also killed. By Friday the death toll was being put at more than 40, according to the Associated Press.

The police defended their actions, saying they acted to maintain law and order.

Protesters also set fire to a Hindu temple and houses in Noakhali district, south of Dhaka, news agencies said. In the town of Cox's Bazar, a police camp was attacked.

In the capital extra police and a rapid response force were deployed, and paramilitaries put on standby, a home ministry official said.

Haider Ali, a prosecutor at the tribunal, said the court decision had meant justice being done.

The tribunal was set up in 2010 by Sheikh Hasina's government to secure justice for victims of the 1971 conflict and heal the rifts of the civil war era but has proved hugely divisive.

Haider Ali said after the verdict: "The nation is rid of stigma after 40 years. It's a victory for the people."

But Abdur Razzaque, the lead defence lawyer, said Sayedee, a well-known Islamic preacher, was the victim of mistaken identity. "Justice has not been served today. The man the prosecution has described as committing atrocities is not the same man as the [Jamaat] leader Delwar Hossain Sayedee." The defence would appeal.

Lawyers in court during the verdict said Sayedee told the tribunal the judges had bowed to pressure from pro-government protesters and "atheists" in Shahbag.

At Shahbag square activists who had held a vigil demanding capital punishment for all the men tried at the tribunal, celebrated as the verdict filtered out, waving flags and hugging each other.

"This is the outcome we wanted," said Shahab Uddin, a college student, who said he had been participating in the rallies at Shahbag since 5 February. "This is what the people are here for."

Analysts say the rival demonstrations and spiralling violence indicate the gulf between those who think the Shahbag rallies are righting a historical wrong and those who see them as a diversion cracking down on Islamist parties.

Some observers have likened the protests to those in Egypt two years ago. Both involved large numbers of young people and were in part dependent on social media for mobilisation.

However the demonstrations in Bangladesh have been pro-government, pointed out Farzana Shaikh, an analyst at London's Chatham House.

Michael Kugelman, south Asia expert at the Woodrow Wilson International Centre, Washington, also warned against comparisons with the Arab spring. "In Eypt and elsewhere it was all about movements to bring democratic change. Bangladesh already has democracy, however flawed," he said. A general election is likely later this year.

Kugelman added however that "there are a lot of young people really looking at this occasion to stress the necessity of liberalism, secularism, in Bangladesh and who see this as a springboard".

Bangladesh declared independence from Pakistan in 1971. The Pakistani army fought and lost a brutal nine-month war with Bengali fighters and Indian forces that intervened. Hundreds of thousands of civilians died, many of them at the hands of Islamist militia groups who wanted the country to remain part of Pakistan.

Sheikh Hasina, the prime minister, and daughter of the wartime leader Sheikh Mujibur Rahman, set up the war crimes tribunal to investigate atrocities committed during the 1971 conflict – a move she said would bring closure for victims and families and heal the rifts.

The leader of the opposition Bangladesh Nationalist party, Khaleda Zia, the widow of the independence war's best-known military commander, has accused Hasina of politicising the tribunal, using it to hound political enemies.

All of the 10 indicted for war crimes by the tribunal are opposition politicians, eight from Jamaat-e-Islami, the party that is an ally of the BNP.

"These are deep unhealed wounds, going back for decades and there is a very strong popular desire to resolve many unanswered questions [about the 1971 conflict] and deep frustration with successive governments' failure to do that," Shaikh said. "But its not entirely accidental that the momentum for this resolution has come from the Awami League not the BNP."

Kugelman also stressed that the demonstrations in Bangladesh remained relatively localised and had yet to attract significant support in rural areas.

Observers have noticed how, despite criticism from human rights groups about politicisation and procedural flaws, the war crimes tribunal has remained broadly popular.

Last month the tribunal sentenced a former member of Jamaat-e-Islami to death for his role in the 1971 war. On 5 February Abdul Quader Molla, a leader of Jamaat-e-Islami received a verdict of life imprisonment.

Sam Zarifi, the Asia director for the International Commission of Jurists, a Geneva-based legal advocacy group, said a fair trial process was necessary to heal the wounds of the war.

"It is very important that victims of 1971 get justice," he said. "But justice must be ensured through a fair and transparent trial process. Unfortunately, if judges are intimidated by mass protests into handing out death sentences, that's not justice and may unleash yet another cycle of violence."

The trial has been dogged by controversy. Earlier, the tribunal's chairman resigned after transcripts emerged of Skype conversations between him and a Belgium-based Bangladeshi lawyer not officially connected to the case.

Human rights groups said the resignation left a panel where none of the three judges had heard the entire evidence. Appeals for a retrial were dismissed by the tribunal.

Jamaat-e-Islami has called a three-day general strike beginning on Saturday.

• This article was amended on 1 March 2013 because the original misspelled Farzana Shaikh's surname as Sheikh.